Merge branch '1.11'

This commit is contained in:
Vasco Lavos committed 2017-03-10 18:01:37 +00:00
commit 1a5262a659
2404 files changed
+8164 -10354

No files matched your search

@@ -694,7 +694,7 @@ public final class BotaniaAPI {
}
private static String getMagnetKey(ItemStack stack) {
if(stack == null)
if(stack.isEmpty())
return "";
return "i_" + stack.getItem().getUnlocalizedName() + "@" + stack.getItemDamage();
@@ -142,7 +142,7 @@ public final class CorporeaHelper {
* Bridge for requestItem() using an ItemStack.
*/
public static List<ItemStack> requestItem(ItemStack stack, ICorporeaSpark spark, boolean checkNBT, boolean doit) {
return requestItem(stack, stack.stackSize, spark, checkNBT, doit);
return requestItem(stack, stack.getCount(), spark, checkNBT, doit);
}
/**
@@ -232,14 +232,14 @@ public final class CorporeaHelper {
* Gets if two stacks match.
*/
public static boolean stacksMatch(ItemStack stack1, ItemStack stack2, boolean checkNBT) {
return stack1 != null && stack2 != null && stack1.isItemEqual(stack2) && (!checkNBT || ItemStack.areItemStackTagsEqual(stack1, stack2));
return !stack1.isEmpty() && !stack2.isEmpty() && stack1.isItemEqual(stack2) && (!checkNBT || ItemStack.areItemStackTagsEqual(stack1, stack2));
}
/**
* Gets if the name of a stack matches the string passed in.
*/
public static boolean stacksMatch(ItemStack stack, String s) {
if(stack == null)
if(stack.isEmpty())
return false;
boolean contains = false;
@@ -32,7 +32,7 @@ public interface IManaNetwork {
/**
* Gets the closest Mana Collector (eg. Mana Spreader) in the network to the Chunk
* Coordinates passed in, in the given dimension.<br>
* A way of getting the dimension is via worldObj.provider.dimensionId<br>
* A way of getting the dimension is via world.provider.dimensionId<br>
* Note that this function *can* get performance intensive, it's reccomended you
* call it sparingly and take cache of the value returned.
* @param limit The maximum distance the closest block can be, if the closest block
@@ -43,7 +43,7 @@ public interface IManaNetwork {
/**
* Gets the closest Mana Pool in the network to the Chunk Coordinates passed in,
* in the given dimension.<br>
* A way of getting the dimension is via worldObj.provider.dimensionId<br>
* A way of getting the dimension is via world.provider.dimensionId<br>
* Note that this function *can* get performance intensive, it's reccomended you
* call it sparingly and take cache of the value returned.
* @param limit The maximum distance the closest block can be, if the closest block
@@ -11,15 +11,24 @@
package vazkii.botania.api.internal;
import net.minecraft.block.state.IBlockState;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.server.management.PlayerChunkMapEntry;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
public final class VanillaPacketDispatcher {
public static void dispatchTEToNearbyPlayers(TileEntity tile) {
IBlockState state = tile.getWorld().getBlockState(tile.getPos());
tile.getWorld().notifyBlockUpdate(tile.getPos(), state, state, 8);
SPacketUpdateTileEntity packet = tile.getUpdatePacket();
if(packet != null && tile.getWorld() instanceof WorldServer) {
PlayerChunkMapEntry chunk = ((WorldServer) tile.getWorld()).getPlayerChunkMap().getEntry(tile.getPos().getX() >> 4, tile.getPos().getZ() >> 4);
if(chunk != null) {
chunk.sendPacket(packet);
}
}
}
public static void dispatchTEToNearbyPlayers(World world, BlockPos pos) {
@@ -33,7 +33,7 @@ public interface IManaProficiencyArmor {
return false;
}
default boolean shouldGiveProficiency(ItemStack armorStack, EntityEquipmentSlot slot, EntityPlayer player, @Nullable ItemStack rod) {
default boolean shouldGiveProficiency(ItemStack armorStack, EntityEquipmentSlot slot, EntityPlayer player, ItemStack rod) {
return shouldGiveProficiency(armorStack, slot, player);
}
@@ -41,17 +41,17 @@ public interface IManaProficiencyArmor {
@Deprecated
public static boolean hasProficiency(EntityPlayer player) {
return hasProficiency(player, null);
return hasProficiency(player, ItemStack.EMPTY);
}
public static boolean hasProficiency(EntityPlayer player, @Nullable ItemStack rod) {
public static boolean hasProficiency(EntityPlayer player, ItemStack rod) {
boolean proficient = false;
for(EntityEquipmentSlot e: EntityEquipmentSlot.values()) {
if(e.getSlotType() != EntityEquipmentSlot.Type.ARMOR)
continue;
ItemStack armor = player.getItemStackFromSlot(e);
if(armor != null) {
if(!armor.isEmpty()) {
Item item = armor.getItem();
if(item instanceof IManaProficiencyArmor && ((IManaProficiencyArmor) item).shouldGiveProficiency(armor, e, player, rod)) {
proficient = true;
@@ -31,7 +31,7 @@ public class LexiconEntry implements Comparable<LexiconEntry> {
public final List<LexiconPage> pages = new ArrayList<>();
private boolean priority = false;
private ItemStack icon = null;
private ItemStack icon = ItemStack.EMPTY;
private final List<ItemStack> extraDisplayedRecipes = new ArrayList<>();
@@ -130,13 +130,10 @@ public class LexiconEntry implements Comparable<LexiconEntry> {
public List<ItemStack> getDisplayedRecipes() {
ArrayList<ItemStack> list = new ArrayList<>();
for(LexiconPage page : pages) {
List<ItemStack> l = page.getDisplayedRecipes();
ArrayList<ItemStack> itemsAddedThisPage = new ArrayList<>();
if(l != null) {
ArrayList<ItemStack> itemsAddedThisPage = new ArrayList<>();
for(ItemStack s : l) {
addItem: {
for(ItemStack s : page.getDisplayedRecipes()) {
addItem: {
for(ItemStack s1 : itemsAddedThisPage)
if(s1.getItem() == s.getItem())
break addItem;
@@ -147,7 +144,6 @@ public class LexiconEntry implements Comparable<LexiconEntry> {
itemsAddedThisPage.add(s);
list.add(s);
}
}
}
}
@@ -12,6 +12,7 @@ package vazkii.botania.api.lexicon;
import java.util.List;
import com.google.common.collect.ImmutableList;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
@@ -84,10 +85,10 @@ public abstract class LexiconPage {
/**
* Shows the list of recipes present in this page for display in the category
* page. Can return null for an entry with no recipes.
* page.
*/
public List<ItemStack> getDisplayedRecipes() {
return null;
return ImmutableList.of();
}
public String getUnlocalizedName() {
@@ -35,7 +35,7 @@ public final class LexiconRecipeMappings {
if(force || !mappings.containsKey(str))
mappings.put(str, data);
if(entry.getIcon() == null)
if(entry.getIcon().isEmpty())
entry.setIcon(stack.copy());
}
@@ -59,7 +59,7 @@ public final class LexiconRecipeMappings {
}
public static String stackToString(ItemStack stack, boolean forceIgnore) {
if(stack == null || stack.getItem() == null)
if(stack.isEmpty())
return "NULL";
if(stack.hasTagCompound() && stack.getItem() instanceof IRecipeKeyProvider)
@@ -84,12 +84,12 @@ public class Multiblock {
}
private void addStack(ItemStack stack) {
if(stack == null)
if(stack.isEmpty())
return;
for(ItemStack oStack : materials)
if(oStack.isItemEqual(stack) && ItemStack.areItemStackTagsEqual(oStack, stack)) {
oStack.stackSize += stack.stackSize;
oStack.grow(stack.getCount());
return;
}
@@ -22,7 +22,7 @@ public class ManaDiscountEvent extends Event {
private float discount;
private ItemStack tool;
public ManaDiscountEvent(EntityPlayer entityPlayer, float discount, @Nullable ItemStack tool) {
public ManaDiscountEvent(EntityPlayer entityPlayer, float discount, ItemStack tool) {
this.entityPlayer = entityPlayer;
this.discount = discount;
this.tool = tool;
@@ -30,10 +30,10 @@ public class ManaDiscountEvent extends Event {
@Deprecated
public ManaDiscountEvent(EntityPlayer entityPlayer, float discount) {
this(entityPlayer, discount, null);
this(entityPlayer, discount, ItemStack.EMPTY);
}
@Nullable
public ItemStack getTool() {
return tool;
}
@@ -19,9 +19,10 @@ import java.util.Map.Entry;
import javax.annotation.Nullable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import vazkii.botania.api.BotaniaAPI;
public final class ManaItemHandler {
@@ -36,15 +37,15 @@ public final class ManaItemHandler {
if (player == null)
return new ArrayList<ItemStack>();
IInventory mainInv = player.inventory;
IItemHandler mainInv = player.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
List<ItemStack> toReturn = new ArrayList<ItemStack>();
int size = mainInv.getSizeInventory();
int size = mainInv.getSlots();
for(int slot = 0; slot < size; slot++) {
ItemStack stackInSlot = mainInv.getStackInSlot(slot);
if(stackInSlot != null && stackInSlot.getItem() instanceof IManaItem) {
if(!stackInSlot.isEmpty() && stackInSlot.getItem() instanceof IManaItem) {
toReturn.add(stackInSlot);
}
}
@@ -63,18 +64,18 @@ public final class ManaItemHandler {
if (player == null)
return new HashMap<Integer, ItemStack>();
IInventory baublesInv = BotaniaAPI.internalHandler.getBaublesInventory(player);
IItemHandler baublesInv = BotaniaAPI.internalHandler.getBaublesInventoryWrapped(player);
if (baublesInv == null)
return new HashMap<Integer, ItemStack>();
Map<Integer, ItemStack> toReturn = new HashMap<Integer, ItemStack>();
int size = baublesInv.getSizeInventory();
int size = baublesInv.getSlots();
for(int slot = 0; slot < size; slot++) {
ItemStack stackInSlot = baublesInv.getStackInSlot(slot);
if(stackInSlot != null && stackInSlot.getItem() instanceof IManaItem) {
if(!stackInSlot.isEmpty() && stackInSlot.getItem() instanceof IManaItem) {
toReturn.put(slot, stackInSlot);
}
}
@@ -90,7 +91,7 @@ public final class ManaItemHandler {
* @return The amount of mana received from the request.
*/
public static int requestMana(ItemStack stack, EntityPlayer player, int manaToGet, boolean remove) {
if(stack == null)
if(stack.isEmpty())
return 0;
List<ItemStack> items = getManaItems(player);
@@ -143,7 +144,7 @@ public final class ManaItemHandler {
* @return If the request was succesful.
*/
public static boolean requestManaExact(ItemStack stack, EntityPlayer player, int manaToGet, boolean remove) {
if(stack == null)
if(stack.isEmpty())
return false;
List<ItemStack> items = getManaItems(player);
@@ -191,7 +192,7 @@ public final class ManaItemHandler {
* @return The amount of mana actually sent.
*/
public static int dispatchMana(ItemStack stack, EntityPlayer player, int manaToSend, boolean add) {
if(stack == null)
if(stack.isEmpty())
return 0;
List<ItemStack> items = getManaItems(player);
@@ -251,7 +252,7 @@ public final class ManaItemHandler {
* @return If an item received the mana sent.
*/
public static boolean dispatchManaExact(ItemStack stack, EntityPlayer player, int manaToSend, boolean add) {
if(stack == null)
if(stack.isEmpty())
return false;
List<ItemStack> items = getManaItems(player);
@@ -328,11 +329,11 @@ public final class ManaItemHandler {
* Gets the sum of all the discounts on IManaDiscountArmor items equipped
* on the player passed in. This discount can vary based on what the passed tool is.
*/
public static float getFullDiscountForTools(EntityPlayer player, @Nullable ItemStack tool) {
public static float getFullDiscountForTools(EntityPlayer player, ItemStack tool) {
float discount = 0F;
for(int i = 0; i < player.inventory.armorInventory.length; i++) {
ItemStack armor = player.inventory.armorInventory[i];
if(armor != null && armor.getItem() instanceof IManaDiscountArmor)
for(int i = 0; i < player.inventory.armorInventory.size(); i++) {
ItemStack armor = player.inventory.armorInventory.get(i);
if(!armor.isEmpty() && armor.getItem() instanceof IManaDiscountArmor)
discount += ((IManaDiscountArmor) armor.getItem()).getDiscount(armor, i, player, tool);
}
@@ -10,10 +10,6 @@
*/
package vazkii.botania.api.mana;
import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.eventhandler.Event;
@@ -24,7 +20,7 @@ public class ManaProficiencyEvent extends Event {
private ItemStack rod;
private boolean proficient;
public ManaProficiencyEvent(EntityPlayer entityPlayer, @Nullable ItemStack rod, boolean proficient) {
public ManaProficiencyEvent(EntityPlayer entityPlayer, ItemStack rod, boolean proficient) {
this.entityPlayer = entityPlayer;
this.rod = rod;
this.proficient = proficient;
@@ -34,7 +30,6 @@ public class ManaProficiencyEvent extends Event {
return entityPlayer;
}
@Nullable
public ItemStack getRod() {
return rod;
}
@@ -1,4 +1,4 @@
@API(owner = "Botania", apiVersion = "85", provides = "BotaniaAPI")
@API(owner = "Botania", apiVersion = "86", provides = "BotaniaAPI")
package vazkii.botania.api;
import net.minecraftforge.fml.common.API;
@@ -45,7 +45,7 @@ public class RecipeBrew {
for(int i = 0; i < inv.getSlots(); i++) {
ItemStack stack = inv.getStackInSlot(i);
if(stack == null)
if(stack.isEmpty())
break;
if(stack.getItem() instanceof IBrewContainer)
@@ -106,7 +106,7 @@ public class RecipeBrew {
}
public ItemStack getOutput(ItemStack stack) {
if(stack == null || !(stack.getItem() instanceof IBrewContainer))
if(stack.isEmpty() || !(stack.getItem() instanceof IBrewContainer))
return new ItemStack(Items.GLASS_BOTTLE); // Fallback...
IBrewContainer container = (IBrewContainer) stack.getItem();
@@ -31,7 +31,7 @@ public class RecipeElvenTrade {
List<ItemStack> stacksToRemove = new ArrayList<>();
for(ItemStack stack : stacks) {
if(stack == null) {
if(stack.isEmpty()) {
continue;
}
if(inputsMissing.isEmpty())
@@ -42,7 +42,7 @@ public class RecipePetals {
for(int i = 0; i < inv.getSlots(); i++) {
ItemStack stack = inv.getStackInSlot(i);
if(stack == null)
if(stack.isEmpty())
break;
int stackIndex = -1, oredictIndex = -1;
@@ -59,7 +59,7 @@ public class RecipePureDaisy {
}
private boolean isOreDict(ItemStack stack, String entry) {
if(stack == null || stack.getItem() == null)
if(stack.isEmpty())
return false;
List<ItemStack> ores;
@@ -9,53 +9,53 @@ import net.minecraft.util.SoundEvent;
*/
public final class BotaniaSoundEvents {
public static final SoundEvent airRod = getRegisteredSoundEvent("botania:airRod");
public static final SoundEvent agricarnation = getRegisteredSoundEvent("botania:agricarnation");
public static final SoundEvent altarCraft = getRegisteredSoundEvent("botania:altarCraft");
public static final SoundEvent babylonAttack = getRegisteredSoundEvent("botania:babylonAttack");
public static final SoundEvent babylonSpawn = getRegisteredSoundEvent("botania:babylonSpawn");
public static final SoundEvent bellows = getRegisteredSoundEvent("botania:bellows");
public static final SoundEvent bifrostRod = getRegisteredSoundEvent("botania:bifrostRod");
public static final SoundEvent blackLotus = getRegisteredSoundEvent("botania:blackLotus");
public static final SoundEvent dash = getRegisteredSoundEvent("botania:dash");
public static final SoundEvent ding = getRegisteredSoundEvent("botania:ding");
public static final SoundEvent divaCharm = getRegisteredSoundEvent("botania:divaCharm");
public static final SoundEvent divinationRod = getRegisteredSoundEvent("botania:divinationRod");
public static final SoundEvent doit = getRegisteredSoundEvent("botania:doit");
public static final SoundEvent enchanterFade = getRegisteredSoundEvent("botania:enchanterForm");
public static final SoundEvent enchanterForm = getRegisteredSoundEvent("botania:enchanterFade");
public static final SoundEvent enchanterEnchant = getRegisteredSoundEvent("botania:enchanterEnchant");
public static final SoundEvent endoflame = getRegisteredSoundEvent("botania:endoflame");
public static final SoundEvent equipBauble = getRegisteredSoundEvent("botania:equipBauble");
public static final SoundEvent gaiaTrap = getRegisteredSoundEvent("botania:gaiaTrap");
public static final SoundEvent goldenLaurel = getRegisteredSoundEvent("botania:goldenLaurel");
public static final SoundEvent holyCloak = getRegisteredSoundEvent("botania:holyCloak");
public static final SoundEvent laputaStart = getRegisteredSoundEvent("botania:laputaStart");
public static final SoundEvent lexiconOpen = getRegisteredSoundEvent("botania:lexiconOpen");
public static final SoundEvent lexiconPage = getRegisteredSoundEvent("botania:lexiconPage");
public static final SoundEvent lightRelay = getRegisteredSoundEvent("botania:lightRelay");
public static final SoundEvent manaBlaster = getRegisteredSoundEvent("botania:manaBlaster");
public static final SoundEvent manaPoolCraft = getRegisteredSoundEvent("botania:manaPoolCraft");
public static final SoundEvent missile = getRegisteredSoundEvent("botania:missile");
public static final SoundEvent orechid = getRegisteredSoundEvent("botania:orechid");
public static final SoundEvent potionCreate = getRegisteredSoundEvent("botania:potionCreate");
public static final SoundEvent runeAltarCraft = getRegisteredSoundEvent("botania:runeAltarCraft");
public static final SoundEvent runeAltarStart = getRegisteredSoundEvent("botania:runeAltarStart");
public static final SoundEvent spreaderFire = getRegisteredSoundEvent("botania:spreaderFire");
public static final SoundEvent starcaller = getRegisteredSoundEvent("botania:starcaller");
public static final SoundEvent terraBlade = getRegisteredSoundEvent("botania:terraBlade");
public static final SoundEvent terraformRod = getRegisteredSoundEvent("botania:terraformRod");
public static final SoundEvent terraPickMode = getRegisteredSoundEvent("botania:terraPickMode");
public static final SoundEvent terrasteelCraft = getRegisteredSoundEvent("botania:terrasteelCraft");
public static final SoundEvent thermalily = getRegisteredSoundEvent("botania:thermalily");
public static final SoundEvent unholyCloak = getRegisteredSoundEvent("botania:unholyCloak");
public static final SoundEvent way = getRegisteredSoundEvent("botania:way");
public static final SoundEvent airRod = getRegisteredSoundEvent("airrod");
public static final SoundEvent agricarnation = getRegisteredSoundEvent("agricarnation");
public static final SoundEvent altarCraft = getRegisteredSoundEvent("altarcraft");
public static final SoundEvent babylonAttack = getRegisteredSoundEvent("babylonattack");
public static final SoundEvent babylonSpawn = getRegisteredSoundEvent("babylonspawn");
public static final SoundEvent bellows = getRegisteredSoundEvent("bellows");
public static final SoundEvent bifrostRod = getRegisteredSoundEvent("bifrostrod");
public static final SoundEvent blackLotus = getRegisteredSoundEvent("blacklotus");
public static final SoundEvent dash = getRegisteredSoundEvent("dash");
public static final SoundEvent ding = getRegisteredSoundEvent("ding");
public static final SoundEvent divaCharm = getRegisteredSoundEvent("divacharm");
public static final SoundEvent divinationRod = getRegisteredSoundEvent("divinationrod");
public static final SoundEvent doit = getRegisteredSoundEvent("doit");
public static final SoundEvent enchanterFade = getRegisteredSoundEvent("enchanterform");
public static final SoundEvent enchanterForm = getRegisteredSoundEvent("enchanterfade");
public static final SoundEvent enchanterEnchant = getRegisteredSoundEvent("enchanterenchant");
public static final SoundEvent endoflame = getRegisteredSoundEvent("endoflame");
public static final SoundEvent equipBauble = getRegisteredSoundEvent("equipbauble");
public static final SoundEvent gaiaTrap = getRegisteredSoundEvent("gaiatrap");
public static final SoundEvent goldenLaurel = getRegisteredSoundEvent("goldenlaurel");
public static final SoundEvent holyCloak = getRegisteredSoundEvent("holycloak");
public static final SoundEvent laputaStart = getRegisteredSoundEvent("laputastart");
public static final SoundEvent lexiconOpen = getRegisteredSoundEvent("lexiconopen");
public static final SoundEvent lexiconPage = getRegisteredSoundEvent("lexiconpage");
public static final SoundEvent lightRelay = getRegisteredSoundEvent("lightrelay");
public static final SoundEvent manaBlaster = getRegisteredSoundEvent("manablaster");
public static final SoundEvent manaPoolCraft = getRegisteredSoundEvent("manapoolcraft");
public static final SoundEvent missile = getRegisteredSoundEvent("missile");
public static final SoundEvent orechid = getRegisteredSoundEvent("orechid");
public static final SoundEvent potionCreate = getRegisteredSoundEvent("potioncreate");
public static final SoundEvent runeAltarCraft = getRegisteredSoundEvent("runealtarcraft");
public static final SoundEvent runeAltarStart = getRegisteredSoundEvent("runealtarstart");
public static final SoundEvent spreaderFire = getRegisteredSoundEvent("spreaderfire");
public static final SoundEvent starcaller = getRegisteredSoundEvent("starcaller");
public static final SoundEvent terraBlade = getRegisteredSoundEvent("terrablade");
public static final SoundEvent terraformRod = getRegisteredSoundEvent("terraformrod");
public static final SoundEvent terraPickMode = getRegisteredSoundEvent("terrapickmode");
public static final SoundEvent terrasteelCraft = getRegisteredSoundEvent("terrasteelcraft");
public static final SoundEvent thermalily = getRegisteredSoundEvent("thermalily");
public static final SoundEvent unholyCloak = getRegisteredSoundEvent("unholycloak");
public static final SoundEvent way = getRegisteredSoundEvent("way");
public static final SoundEvent gaiaMusic1 = getRegisteredSoundEvent("botania:music.gaia1");
public static final SoundEvent gaiaMusic2 = getRegisteredSoundEvent("botania:music.gaia2");
public static final SoundEvent gaiaMusic1 = getRegisteredSoundEvent("music.gaia1");
public static final SoundEvent gaiaMusic2 = getRegisteredSoundEvent("music.gaia2");
private static SoundEvent getRegisteredSoundEvent(String name) {
return SoundEvent.REGISTRY.getObject(new ResourceLocation(name));
return SoundEvent.REGISTRY.getObject(new ResourceLocation("botania", name));
}
private BotaniaSoundEvents() {}
@@ -133,7 +133,7 @@ public class SubTileEntity {
/**
* Called when a player right clicks this sub tile.
*/
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing side, float hitX, float hitY, float hitZ) { return false; }
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { return false; }
/**
* Called when this sub tile is added to the world.
@@ -137,7 +137,7 @@ public class SubTileFunctional extends SubTileEntity {
return false;
knownMana = mana;
player.worldObj.playSound(null, player.posX, player.posY, player.posZ, BotaniaSoundEvents.ding, SoundCategory.PLAYERS, 0.1F, 1F);
player.world.playSound(null, player.posX, player.posY, player.posZ, BotaniaSoundEvents.ding, SoundCategory.PLAYERS, 0.1F, 1F);
return super.onWanded(player, wand);
}
@@ -199,7 +199,7 @@ public class SubTileFunctional extends SubTileEntity {
double dist = pos.distanceSq(supertile.getPos());
if(range >= dist) {
TileEntity tile = player.worldObj.getTileEntity(pos);
TileEntity tile = player.world.getTileEntity(pos);
if(tile instanceof IManaPool) {
linkedPool = tile;
return true;
@@ -210,7 +210,7 @@ public class SubTileFunctional extends SubTileEntity {
}
public boolean isValidBinding() {
return linkedPool != null && linkedPool.hasWorldObj() && !linkedPool.isInvalid() && supertile.getWorld().isBlockLoaded(linkedPool.getPos(), false) && supertile.getWorld().getTileEntity(linkedPool.getPos()) == linkedPool;
return linkedPool != null && linkedPool.hasWorld() && !linkedPool.isInvalid() && supertile.getWorld().isBlockLoaded(linkedPool.getPos(), false) && supertile.getWorld().getTileEntity(linkedPool.getPos()) == linkedPool;
}
@SideOnly(Side.CLIENT)
@@ -197,7 +197,7 @@ public class SubTileGenerating extends SubTileEntity {
public void populateDropStackNBTs(List<ItemStack> drops) {
if(isPassiveFlower() && ticksExisted > 0 && BotaniaAPI.internalHandler.getPassiveFlowerDecay() > 0) {
ItemStack drop = drops.get(0);
if(drop != null) {
if(!drop.isEmpty()) {
if(!drop.hasTagCompound())
drop.setTagCompound(new NBTTagCompound());
NBTTagCompound cmp = drop.getTagCompound();
@@ -220,11 +220,11 @@ public class SubTileGenerating extends SubTileEntity {
if(player == null)
return false;
if(!player.worldObj.isRemote)
if(!player.world.isRemote)
sync();
knownMana = mana;
player.worldObj.playSound(null, player.posX, player.posY, player.posZ, BotaniaSoundEvents.ding, SoundCategory.PLAYERS, 0.1F, 1F);
player.world.playSound(null, player.posX, player.posY, player.posZ, BotaniaSoundEvents.ding, SoundCategory.PLAYERS, 0.1F, 1F);
return super.onWanded(player, wand);
}
@@ -289,7 +289,7 @@ public class SubTileGenerating extends SubTileEntity {
double dist = pos.distanceSq(supertile.getPos());
if(range >= dist) {
TileEntity tile = player.worldObj.getTileEntity(pos);
TileEntity tile = player.world.getTileEntity(pos);
if(tile instanceof IManaCollector) {
linkedCollector = tile;
return true;
@@ -53,10 +53,10 @@ public class SimpleWikiProvider implements IWikiProvider {
ItemStack stack = state.getBlock().getPickBlock(state, pos, world, bPos, player);
if(stack == null || stack.getItem() == null)
if(stack.isEmpty())
stack = new ItemStack(state.getBlock(), 1, state.getBlock().damageDropped(state));
if(stack.getItem() == null)
if(stack.isEmpty())
return null;
String name = stack.getDisplayName();
@@ -36,14 +36,14 @@ public final class AstrolabePreviewHandler {
@SubscribeEvent
public static void onWorldRenderLast(RenderWorldLastEvent event) {
World world = Minecraft.getMinecraft().theWorld;
World world = Minecraft.getMinecraft().world;
List<EntityPlayer> playerEntities = world.playerEntities;
for (EntityPlayer player : playerEntities) {
ItemStack currentStack = player.getHeldItemMainhand();
if(currentStack == null || !(currentStack.getItem() instanceof ItemAstrolabe))
if(currentStack.isEmpty() || !(currentStack.getItem() instanceof ItemAstrolabe))
currentStack = player.getHeldItemOffhand();
if(currentStack != null && currentStack.getItem() instanceof ItemAstrolabe) {
if(!currentStack.isEmpty() && currentStack.getItem() instanceof ItemAstrolabe) {
Block block = ItemAstrolabe.getBlock(currentStack);
if(block != Blocks.AIR)
renderPlayerLook(player, currentStack);
@@ -76,9 +76,6 @@ public final class AstrolabePreviewHandler {
private static void renderBlockAt(Block block, int meta, BlockPos pos) {
IBlockState state = block.getStateFromMeta(meta);
if(state == null)
return;
double renderPosX, renderPosY, renderPosZ;
@@ -12,6 +12,7 @@ package vazkii.botania.client.core.handler;
import javax.annotation.Nonnull;
import net.minecraftforge.items.IItemHandler;
import org.lwjgl.opengl.GL11;
import baubles.api.BaublesApi;
@@ -24,7 +25,6 @@ import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import vazkii.botania.api.item.IBaubleRender;
@@ -43,10 +43,10 @@ public final class BaubleRenderHandler implements LayerRenderer<EntityPlayer> {
if(!ConfigHandler.renderBaubles || player.getActivePotionEffect(MobEffects.INVISIBILITY) != null)
return;
IInventory inv = BaublesApi.getBaubles(player);
IItemHandler inv = BaublesApi.getBaublesHandler(player);
dispatchRenders(inv, player, RenderType.BODY, partialTicks);
if(inv.getStackInSlot(3) != null)
if(!inv.getStackInSlot(3).isEmpty())
renderManaTablet(player);
float yaw = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * partialTicks;
@@ -60,16 +60,16 @@ public final class BaubleRenderHandler implements LayerRenderer<EntityPlayer> {
dispatchRenders(inv, player, RenderType.HEAD, partialTicks);
ItemStack helm = player.inventory.armorItemInSlot(3);
if(helm != null && helm.getItem() instanceof ItemTerrasteelHelm)
if(!helm.isEmpty() && helm.getItem() instanceof ItemTerrasteelHelm)
ItemTerrasteelHelm.renderOnPlayer(helm, player);
GlStateManager.popMatrix();
}
private void dispatchRenders(IInventory inv, EntityPlayer player, RenderType type, float partialTicks) {
for(int i = 0; i < inv.getSizeInventory(); i++) {
private void dispatchRenders(IItemHandler inv, EntityPlayer player, RenderType type, float partialTicks) {
for(int i = 0; i < inv.getSlots(); i++) {
ItemStack stack = inv.getStackInSlot(i);
if(stack != null) {
if(!stack.isEmpty()) {
Item item = stack.getItem();
if(item instanceof IPhantomInkable) {
@@ -81,7 +81,7 @@ public final class BaubleRenderHandler implements LayerRenderer<EntityPlayer> {
if(item instanceof ICosmeticAttachable) {
ICosmeticAttachable attachable = (ICosmeticAttachable) item;
ItemStack cosmetic = attachable.getCosmeticItem(stack);
if(cosmetic != null) {
if(!cosmetic.isEmpty()) {
GlStateManager.pushMatrix();
GL11.glColor3ub((byte) 255, (byte) 255, (byte) 255); // Some of the baubles use this so we must restore it manually as well
GlStateManager.color(1F, 1F, 1F, 1F);
@@ -107,11 +107,11 @@ public final class BaubleRenderHandler implements LayerRenderer<EntityPlayer> {
boolean renderedOne = false;
for(int i = 0; i < player.inventory.getSizeInventory(); i++) {
ItemStack stack = player.inventory.getStackInSlot(i);
if(stack != null && stack.getItem() == ModItems.manaTablet) {
if(!stack.isEmpty() && stack.getItem() == ModItems.manaTablet) {
GlStateManager.pushMatrix();
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
Helper.rotateIfSneaking(player);
boolean armor = player.getItemStackFromSlot(EntityEquipmentSlot.LEGS) != null;
boolean armor = !player.getItemStackFromSlot(EntityEquipmentSlot.LEGS).isEmpty();
GlStateManager.rotate(90, 0, 1, 0);
GlStateManager.rotate(180, 0, 0, 1);
GlStateManager.translate(0, -0.6, 0);
@@ -55,14 +55,14 @@ public final class BlockHighlightRenderHandler {
if(Botania.proxy.isClientPlayerWearingMonocle() && pos != null && pos.entityHit == null) {
BlockPos bPos = pos.getBlockPos();
ItemStack stackHeld = PlayerHelper.getFirstHeldItem(mc.thePlayer, ModItems.twigWand);
if(stackHeld != null && ItemTwigWand.getBindMode(stackHeld)) {
ItemStack stackHeld = PlayerHelper.getFirstHeldItem(mc.player, ModItems.twigWand);
if(!stackHeld.isEmpty() && ItemTwigWand.getBindMode(stackHeld)) {
BlockPos coords = ItemTwigWand.getBoundTile(stackHeld);
if(coords.getY() != -1)
bPos = coords;
}
TileEntity tile = mc.theWorld.getTileEntity(bPos);
TileEntity tile = mc.world.getTileEntity(bPos);
if(tile == null || !(tile instanceof ISubTileContainer))
break boundTile;
ISubTileContainer container = (ISubTileContainer) tile;
@@ -80,7 +80,7 @@ public final class BlockHighlightRenderHandler {
}
double offY = -1.0 / 16 + 0.005;
for(Entity e : mc.theWorld.loadedEntityList)
for(Entity e : mc.world.loadedEntityList)
if(e instanceof EntityMagicLandmine) {
BlockPos bpos = e.getPosition();
AxisAlignedBB aabb = new AxisAlignedBB(bpos).offset(0, offY, 0).expand(2.5, 0, 2.5);
@@ -50,16 +50,16 @@ public final class BoundTileRenderer {
GlStateManager.disableTexture2D();
GlStateManager.enableBlend();
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
EntityPlayer player = Minecraft.getMinecraft().player;
int color = Color.HSBtoRGB(ClientTickHandler.ticksInGame % 200 / 200F, 0.6F, 1F);
if(player.getHeldItemMainhand() != null && player.getHeldItemMainhand().getItem() instanceof ICoordBoundItem) {
if(!player.getHeldItemMainhand().isEmpty() && player.getHeldItemMainhand().getItem() instanceof ICoordBoundItem) {
BlockPos coords = ((ICoordBoundItem) player.getHeldItemMainhand().getItem()).getBinding(player.getHeldItemMainhand());
if(coords != null)
renderBlockOutlineAt(coords, color);
}
if(player.getHeldItemOffhand() != null && player.getHeldItemOffhand().getItem() instanceof ICoordBoundItem) {
if(!player.getHeldItemOffhand().isEmpty() && player.getHeldItemOffhand().getItem() instanceof ICoordBoundItem) {
BlockPos coords = ((ICoordBoundItem) player.getHeldItemOffhand().getItem()).getBinding(player.getHeldItemOffhand());
if(coords != null)
renderBlockOutlineAt(coords, color);
@@ -72,12 +72,11 @@ public final class BoundTileRenderer {
for(int i = 0; i < joined.getSlots(); i++) {
ItemStack stackInSlot = joined.getStackInSlot(i);
if(stackInSlot != null && stackInSlot.getItem() instanceof IWireframeCoordinateListProvider) {
if(!stackInSlot.isEmpty() && stackInSlot.getItem() instanceof IWireframeCoordinateListProvider) {
IWireframeCoordinateListProvider provider = (IWireframeCoordinateListProvider) stackInSlot.getItem();
List<BlockPos> coordsList = provider.getWireframesToDraw(player, stackInSlot);
if(coordsList != null)
for(BlockPos coords : coordsList)
renderBlockOutlineAt(coords, color);
for(BlockPos coords : coordsList)
renderBlockOutlineAt(coords, color);
BlockPos coords = provider.getSourceWireframe(player, stackInSlot);
if(coords != null && coords.getY() > -1)
@@ -112,7 +111,7 @@ public final class BoundTileRenderer {
Color colorRGB = new Color(color);
GL11.glColor4ub((byte) colorRGB.getRed(), (byte) colorRGB.getGreen(), (byte) colorRGB.getBlue(), (byte) 255);
World world = Minecraft.getMinecraft().theWorld;
World world = Minecraft.getMinecraft().world;
IBlockState state = world.getBlockState(pos);
Block block = state.getBlock();
drawWireframe : {
@@ -61,7 +61,7 @@ public final class ClientTickHandler {
RedStringRenderer.tick();
ItemsRemainingRenderHandler.tick();
if(Minecraft.getMinecraft().theWorld == null) {
if(Minecraft.getMinecraft().world == null) {
ManaNetworkHandler.instance.clear();
TileCorporeaIndex.indexes.clear();
SubTileVinculotus.existingFlowers.clear();
@@ -72,10 +72,10 @@ public final class ClientTickHandler {
ticksInGame++;
partialTicks = 0;
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
EntityPlayer player = Minecraft.getMinecraft().player;
if(player != null) {
if(PlayerHelper.hasHeldItemClass(player, ModItems.twigWand)) {
for(TileSignature sig : ImmutableList.copyOf(ManaNetworkHandler.instance.getAllCollectorsInWorld(Minecraft.getMinecraft().theWorld))) {
for(TileSignature sig : ImmutableList.copyOf(ManaNetworkHandler.instance.getAllCollectorsInWorld(Minecraft.getMinecraft().world))) {
if(!sig.isRemote())
continue;
@@ -138,11 +138,11 @@ public final class ColorHandler {
items.registerItemColorHandler((s, t) -> {
ItemStack lens = ItemManaGun.getLens(s);
if(lens != null && t == 0)
if(!lens.isEmpty() && t == 0)
return Minecraft.getMinecraft().getItemColors().getColorFromItemstack(lens, t);
if(t == 2) {
EntityManaBurst burst = ((ItemManaGun) s.getItem()).getBurst(Minecraft.getMinecraft().thePlayer, s, false);
EntityManaBurst burst = ((ItemManaGun) s.getItem()).getBurst(Minecraft.getMinecraft().player, s, false);
Color color = new Color(burst == null ? 0x20FF20 : burst.getColor());
float mul = (float) (Math.sin((double) ClientTickHandler.ticksInGame / 5) * 0.15F);
@@ -18,6 +18,7 @@ import java.util.TreeSet;
import javax.annotation.Nonnull;
import net.minecraft.util.NonNullList;
import org.lwjgl.input.Keyboard;
import com.google.common.collect.ImmutableList;
@@ -50,7 +51,7 @@ public class CorporeaAutoCompleteHandler {
public static void updateItemList() {
itemNames.clear();
Iterator<Item> iterator = Item.REGISTRY.iterator();
ArrayList<ItemStack> curList = new ArrayList<>();
NonNullList<ItemStack> curList = NonNullList.create();
while(iterator.hasNext()) {
Item item = iterator.next();
@@ -78,7 +79,7 @@ public class CorporeaAutoCompleteHandler {
}
GuiChat chat = (GuiChat) screen;
if(isAutoCompleted) {
boolean valid = ReflectionHelper.getPrivateValue(GuiChat.class, chat, LibObfuscation.COMPLETE_FLAG);
boolean valid = false;//ReflectionHelper.getPrivateValue(GuiChat.class, chat, LibObfuscation.COMPLETE_FLAG);
if(!valid)
isAutoCompleted = false;
}
@@ -122,7 +123,7 @@ public class CorporeaAutoCompleteHandler {
if(completions.isEmpty())
return;
position = -1;
ReflectionHelper.setPrivateValue(GuiChat.class, chat, true, LibObfuscation.COMPLETE_FLAG);
//ReflectionHelper.setPrivateValue(GuiChat.class, chat, true, LibObfuscation.COMPLETE_FLAG);
StringBuilder stringbuilder = new StringBuilder();
CompletionData data;
for(Iterator<CompletionData> iterator = completions.iterator(); iterator.hasNext(); stringbuilder.append(data.string)) {
@@ -45,7 +45,7 @@ public final class DebugHandler {
@SubscribeEvent
public static void onDrawDebugText(RenderGameOverlayEvent.Text event) {
World world = Minecraft.getMinecraft().theWorld;
World world = Minecraft.getMinecraft().world;
if(Minecraft.getMinecraft().gameSettings.showDebugInfo) {
event.getLeft().add("");
String version = LibMisc.VERSION;
@@ -56,10 +56,10 @@ public final class DebugHandler {
event.getLeft().add(PREFIX + "(CLIENT) netColl: " + ManaNetworkHandler.instance.getAllCollectorsInWorld(world).size() + ", netPool: " + ManaNetworkHandler.instance.getAllPoolsInWorld(world).size() + ", rv: " + version);
if (Minecraft.getMinecraft().isSingleplayer()) {
UUID id = Minecraft.getMinecraft().thePlayer.getUniqueID();
UUID id = Minecraft.getMinecraft().player.getUniqueID();
Entity ent = Minecraft.getMinecraft().getIntegratedServer().getEntityFromUuid(id);
if (ent != null) {
World serverWorld = Minecraft.getMinecraft().getIntegratedServer().getEntityFromUuid(id).worldObj;
World serverWorld = Minecraft.getMinecraft().getIntegratedServer().getEntityFromUuid(id).world;
event.getLeft().add(PREFIX + String.format("(INTEGRATED SERVER DIM %d) netColl : %d, netPool: %d", serverWorld.provider.getDimension(), ManaNetworkHandler.instance.getAllCollectorsInWorld(serverWorld).size(), ManaNetworkHandler.instance.getAllPoolsInWorld(serverWorld).size()));
}
}
@@ -15,6 +15,8 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import org.lwjgl.opengl.GL11;
import baubles.api.BaublesApi;
@@ -30,7 +32,6 @@ import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.profiler.Profiler;
@@ -88,24 +89,24 @@ public final class HUDHandler {
if(event.getType() == ElementType.HEALTH) {
profiler.startSection("botania-hud");
IInventory baublesInv = BaublesApi.getBaubles(mc.thePlayer);
IItemHandler baublesInv = BaublesApi.getBaublesHandler(mc.player);
ItemStack headpiece = baublesInv.getStackInSlot(4);
if(headpiece != null && headpiece.getItem() == ModItems.flightTiara) {
if(!headpiece.isEmpty() && headpiece.getItem() == ModItems.flightTiara) {
profiler.startSection("flugelTiara");
ItemFlightTiara.renderHUD(event.getResolution(), mc.thePlayer, headpiece);
ItemFlightTiara.renderHUD(event.getResolution(), mc.player, headpiece);
profiler.endSection();
}
dodgeRing: {
ItemStack ring = baublesInv.getStackInSlot(1);
if(ring == null || !(ring.getItem() instanceof ItemDodgeRing)) {
if(ring.isEmpty() || !(ring.getItem() instanceof ItemDodgeRing)) {
ring = baublesInv.getStackInSlot(2);
if(ring == null || !(ring.getItem() instanceof ItemDodgeRing))
if(ring.isEmpty() || !(ring.getItem() instanceof ItemDodgeRing))
break dodgeRing;
}
profiler.startSection("dodgeRing");
ItemDodgeRing.renderHUD(event.getResolution(), mc.thePlayer, ring, event.getPartialTicks());
ItemDodgeRing.renderHUD(event.getResolution(), mc.player, ring, event.getPartialTicks());
profiler.endSection();
}
@@ -117,31 +118,31 @@ public final class HUDHandler {
public static void onDrawScreenPost(RenderGameOverlayEvent.Post event) {
Minecraft mc = Minecraft.getMinecraft();
Profiler profiler = mc.mcProfiler;
ItemStack main = mc.thePlayer.getHeldItemMainhand();
ItemStack offhand = mc.thePlayer.getHeldItemOffhand();
ItemStack main = mc.player.getHeldItemMainhand();
ItemStack offhand = mc.player.getHeldItemOffhand();
if(event.getType() == ElementType.ALL) {
profiler.startSection("botania-hud");
RayTraceResult pos = mc.objectMouseOver;
if(pos != null) {
IBlockState state = pos.typeOfHit == RayTraceResult.Type.BLOCK ? mc.theWorld.getBlockState(pos.getBlockPos()) : null;
IBlockState state = pos.typeOfHit == RayTraceResult.Type.BLOCK ? mc.world.getBlockState(pos.getBlockPos()) : null;
Block block = state == null ? null : state.getBlock();
TileEntity tile = pos.typeOfHit == RayTraceResult.Type.BLOCK ? mc.theWorld.getTileEntity(pos.getBlockPos()) : null;
TileEntity tile = pos.typeOfHit == RayTraceResult.Type.BLOCK ? mc.world.getTileEntity(pos.getBlockPos()) : null;
if(PlayerHelper.hasAnyHeldItem(mc.thePlayer)) {
if(pos != null && PlayerHelper.hasHeldItem(mc.thePlayer, ModItems.twigWand)) {
renderWandModeDisplay(PlayerHelper.getFirstHeldItem(mc.thePlayer, ModItems.twigWand), event.getResolution());
if(PlayerHelper.hasAnyHeldItem(mc.player)) {
if(pos != null && PlayerHelper.hasHeldItem(mc.player, ModItems.twigWand)) {
renderWandModeDisplay(PlayerHelper.getFirstHeldItem(mc.player, ModItems.twigWand), event.getResolution());
if(block instanceof IWandHUD) {
profiler.startSection("wandItem");
((IWandHUD) block).renderHUD(mc, event.getResolution(), mc.theWorld, pos.getBlockPos());
((IWandHUD) block).renderHUD(mc, event.getResolution(), mc.world, pos.getBlockPos());
profiler.endSection();
}
} else if(block != null && PlayerHelper.hasHeldItemClass(mc.thePlayer, ILexicon.class))
drawLexiconHUD(PlayerHelper.getFirstHeldItemClass(mc.thePlayer, ILexicon.class), state, pos, event.getResolution());
if(tile != null && tile instanceof TilePool && mc.thePlayer.getHeldItemMainhand() != null)
renderPoolRecipeHUD(event.getResolution(), (TilePool) tile, mc.thePlayer.getHeldItemMainhand());
} 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())
renderPoolRecipeHUD(event.getResolution(), (TilePool) tile, mc.player.getHeldItemMainhand());
}
if(tile != null && tile instanceof TileAltar)
((TileAltar) tile).renderHUD(mc, event.getResolution());
@@ -153,7 +154,7 @@ public final class HUDHandler {
}
TileCorporeaIndex.getInputHandler();
if(!InputHandler.getNearbyIndexes(mc.thePlayer).isEmpty() && mc.currentScreen != null && mc.currentScreen instanceof GuiChat) {
if(!InputHandler.getNearbyIndexes(mc.player).isEmpty() && mc.currentScreen != null && mc.currentScreen instanceof GuiChat) {
profiler.startSection("nearIndex");
renderNearIndexDisplay(event.getResolution());
profiler.endSection();
@@ -166,57 +167,57 @@ public final class HUDHandler {
profiler.endSection();
}
if(main != null && main.getItem() instanceof ItemCraftingHalo) {
if(!main.isEmpty() && main.getItem() instanceof ItemCraftingHalo) {
profiler.startSection("craftingHalo_main");
ItemCraftingHalo.renderHUD(event.getResolution(), mc.thePlayer, main);
ItemCraftingHalo.renderHUD(event.getResolution(), mc.player, main);
profiler.endSection();
} else if(offhand != null && offhand.getItem() instanceof ItemCraftingHalo) {
} else if(!offhand.isEmpty() && offhand.getItem() instanceof ItemCraftingHalo) {
profiler.startSection("craftingHalo_off");
ItemCraftingHalo.renderHUD(event.getResolution(), mc.thePlayer, offhand);
ItemCraftingHalo.renderHUD(event.getResolution(), mc.player, offhand);
profiler.endSection();
}
if(main != null && main.getItem() instanceof ItemSextant) {
if(!main.isEmpty() && main.getItem() instanceof ItemSextant) {
profiler.startSection("sextant");
ItemSextant.renderHUD(event.getResolution(), mc.thePlayer, main);
ItemSextant.renderHUD(event.getResolution(), mc.player, main);
profiler.endSection();
}
/*if(equippedStack != null && equippedStack.getItem() == ModItems.flugelEye) {
profiler.startSection("flugelEye");
ItemFlugelEye.renderHUD(event.getResolution(), mc.thePlayer, equippedStack);
ItemFlugelEye.renderHUD(event.getResolution(), mc.player, equippedStack);
profiler.endSection();
}*/
if(Botania.proxy.isClientPlayerWearingMonocle()) {
profiler.startSection("monocle");
ItemMonocle.renderHUD(event.getResolution(), mc.thePlayer);
ItemMonocle.renderHUD(event.getResolution(), mc.player);
profiler.endSection();
}
profiler.startSection("manaBar");
EntityPlayer player = mc.thePlayer;
EntityPlayer player = mc.player;
if(!player.isSpectator()) {
int totalMana = 0;
int totalMaxMana = 0;
boolean anyRequest = false;
boolean creative = false;
IInventory mainInv = player.inventory;
IInventory baublesInv = BaublesApi.getBaubles(player);
IItemHandler mainInv = player.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
IItemHandler baublesInv = BaublesApi.getBaublesHandler(player);
int invSize = mainInv.getSizeInventory();
int invSize = mainInv.getSlots();
int size = invSize;
if(baublesInv != null)
size += baublesInv.getSizeInventory();
size += baublesInv.getSlots();
for(int i = 0; i < size; i++) {
boolean useBaubles = i >= invSize;
IInventory inv = useBaubles ? baublesInv : mainInv;
IItemHandler inv = useBaubles ? baublesInv : mainInv;
ItemStack stack = inv.getStackInSlot(i - (useBaubles ? invSize : 0));
if(stack != null) {
if(!stack.isEmpty()) {
Item item = stack.getItem();
if(item instanceof IManaUsingItem)
anyRequest = anyRequest || ((IManaUsingItem) item).usesMana(stack);
@@ -322,7 +323,7 @@ public final class HUDHandler {
int y = res.getScaledHeight() / 2 + 10;
int u = tile.getCurrentMana() >= recipe.getManaToConsume() ? 0 : 22;
int v = mc.thePlayer.getName().equals("haighyorkie") && mc.thePlayer.isSneaking() ? 23 : 8;
int v = mc.player.getName().equals("haighyorkie") && mc.player.isSneaking() ? 23 : 8;
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
@@ -349,7 +350,7 @@ public final class HUDHandler {
profiler.startSection("crystalCube");
ItemStack target = tile.getRequestTarget();
if(target != null) {
if(!target.isEmpty()) {
String s1 = target.getDisplayName();
String s2 = tile.getItemCount() + "x";
int strlen = Math.max(mc.fontRendererObj.getStringWidth(s1), mc.fontRendererObj.getStringWidth(s2));
@@ -386,7 +387,7 @@ public final class HUDHandler {
int sy = res.getScaledHeight() / 2 + 2;
if(block instanceof ILexiconable) {
LexiconEntry entry = ((ILexiconable) block).getEntry(mc.theWorld, pos.getBlockPos(), mc.thePlayer, stack);
LexiconEntry entry = ((ILexiconable) block).getEntry(mc.world, pos.getBlockPos(), mc.player, stack);
if(entry != null) {
if(!((ILexicon) stack.getItem()).isKnowledgeUnlocked(stack, entry.getKnowledgeType()))
font = mc.standardGalacticFontRenderer;
@@ -399,12 +400,12 @@ public final class HUDHandler {
if(!draw && pos.entityHit == null) {
profiler.startSection("wikiLookup");
if(!block.isAir(state, mc.theWorld, pos.getBlockPos()) && !(block instanceof BlockLiquid)) {
if(!block.isAir(state, mc.world, pos.getBlockPos()) && !(block instanceof BlockLiquid)) {
IWikiProvider provider = WikiHooks.getWikiFor(block);
String url = provider.getWikiURL(mc.theWorld, pos, mc.thePlayer);
String url = provider.getWikiURL(mc.world, pos, mc.player);
if(url != null && !url.isEmpty()) {
String name = provider.getBlockName(mc.theWorld, pos, mc.thePlayer);
String wikiName = provider.getWikiName(mc.theWorld, pos, mc.thePlayer);
String name = provider.getBlockName(mc.world, pos, mc.player);
String wikiName = provider.getWikiName(mc.world, pos, mc.player);
drawStr = name + " @ " + TextFormatting.AQUA + wikiName;
draw = true;
}
@@ -413,7 +414,7 @@ public final class HUDHandler {
}
if(draw) {
if(!mc.thePlayer.isSneaking()) {
if(!mc.player.isSneaking()) {
drawStr = "?";
secondLine = "";
font = mc.fontRendererObj;
@@ -424,7 +425,7 @@ public final class HUDHandler {
font.drawStringWithShadow(drawStr, sx + 20, sy + 4, 0xFFFFFFFF);
font.drawStringWithShadow(secondLine, sx + 20, sy + 14, 0xFFAAAAAA);
if(!mc.thePlayer.isSneaking()) {
if(!mc.player.isSneaking()) {
GlStateManager.scale(0.5F, 0.5F, 1F);
mc.fontRendererObj.drawStringWithShadow(TextFormatting.BOLD + "Shift", (sx + 10) * 2 - 16, (sy + 8) * 2 + 20, 0xFFFFFFFF);
GlStateManager.scale(2F, 2F, 1F);
@@ -29,13 +29,13 @@ public final class ItemsRemainingRenderHandler {
private static final int maxTicks = 30;
private static final int leaveTicks = 20;
private static ItemStack stack;
private static ItemStack stack = ItemStack.EMPTY;
private static String customString;
private static int ticks, count;
@SideOnly(Side.CLIENT)
public static void render(ScaledResolution resolution, float partTicks) {
if(ticks > 0 && stack != null) {
if(ticks > 0 && !stack.isEmpty()) {
int pos = maxTicks - ticks;
Minecraft mc = Minecraft.getMinecraft();
int x = resolution.getScaledWidth() / 2 + 10 + Math.max(0, pos - leaveTicks);
@@ -64,7 +64,7 @@ public final class ItemsRemainingRenderHandler {
String text = "";
if(customString == null) {
if(stack != null && stack.getItem() != null) {
if(!stack.isEmpty()) {
text = TextFormatting.GREEN + stack.getDisplayName();
if(count >= 0) {
int max = stack.getMaxStackSize();
@@ -105,15 +105,15 @@ public final class ItemsRemainingRenderHandler {
ItemsRemainingRenderHandler.stack = stack;
ItemsRemainingRenderHandler.count = count;
ItemsRemainingRenderHandler.customString = str;
ticks = stack == null ? 0 : maxTicks;
ticks = stack.isEmpty() ? 0 : maxTicks;
}
public static void set(EntityPlayer player, ItemStack displayStack, Pattern pattern) {
int count = 0;
for(int i = 0; i < player.inventory.getSizeInventory(); i++) {
ItemStack stack = player.inventory.getStackInSlot(i);
if(stack != null && pattern.matcher(stack.getUnlocalizedName()).find())
count += stack.stackSize;
if(!stack.isEmpty() && pattern.matcher(stack.getUnlocalizedName()).find())
count += stack.getCount();
}
set(displayStack, count);
@@ -49,7 +49,7 @@ public class LightningHandler {
profiler.endStartSection("lightning");
float frame = event.getPartialTicks();
Entity entity = Minecraft.getMinecraft().thePlayer;
Entity entity = Minecraft.getMinecraft().player;
TextureManager render = Minecraft.getMinecraft().renderEngine;
double interpPosX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * frame;
@@ -39,7 +39,6 @@ import vazkii.botania.client.model.GunModel;
import vazkii.botania.client.model.LexiconModel;
import vazkii.botania.client.model.PlatformModel;
import vazkii.botania.common.Botania;
import vazkii.botania.common.integration.buildcraft.TriggerManaLevel;
import vazkii.botania.common.item.ItemSparkUpgrade;
import vazkii.botania.common.item.equipment.bauble.ItemFlightTiara;
import vazkii.botania.common.item.relic.ItemKingKey;
@@ -70,7 +69,7 @@ public class MiscellaneousIcons {
public TextureAtlasSprite[] sparkUpgradeIcons;
public TextureAtlasSprite[] kingKeyWeaponIcons;
public final Map<TriggerManaLevel.State, TextureAtlasSprite> manaLevelTriggerIcons = Maps.newEnumMap(TriggerManaLevel.State.class);
// todo buildcraft public final Map<TriggerManaLevel.State, TextureAtlasSprite> manaLevelTriggerIcons = Maps.newEnumMap(TriggerManaLevel.State.class);
public TextureAtlasSprite[] tiaraWingIcons;
public TextureAtlasSprite[] thirdEyeLayers;
@@ -156,9 +155,9 @@ public class MiscellaneousIcons {
manaDetectorIcon = IconHelper.forName(evt.getMap(), "triggers/manaDetector", "items");
runeAltarTriggerIcon = IconHelper.forName(evt.getMap(), "triggers/runeAltarCanCraft", "items");
for (TriggerManaLevel.State s : TriggerManaLevel.State.values()) {
/*for (TriggerManaLevel.State s : TriggerManaLevel.State.values()) { todo buildcraft
manaLevelTriggerIcons.put(s, IconHelper.forName(evt.getMap(), "triggers/mana" + WordUtils.capitalizeFully(s.name()), "items"));
}
}*/
tiaraWingIcons = new TextureAtlasSprite[ItemFlightTiara.WING_TYPES];
for (int i = 0; i < tiaraWingIcons.length; i++) {
@@ -179,7 +178,7 @@ public class MiscellaneousIcons {
@SubscribeEvent
public void dumpAtlas(ArrowLooseEvent evt) {
if (!evt.getEntityPlayer().worldObj.isRemote || !((Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment"))
if (!evt.getEntityPlayer().world.isRemote || !((Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment"))
|| !evt.getEntityPlayer().isSneaking())
return;
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
@@ -13,6 +13,7 @@ package vazkii.botania.client.core.handler;
import javax.annotation.Nonnull;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Biomes;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
@@ -85,10 +86,10 @@ public class MultiblockBlockAccess implements IBlockAccess {
@Nonnull
@Override
public Biome getBiomeGenForCoords(@Nonnull BlockPos pos) {
public Biome getBiome(@Nonnull BlockPos pos) {
if(hasBlockAccess)
return originalBlockAccess.getBiomeGenForCoords(pos);
return null;
return originalBlockAccess.getBiome(pos);
return Biomes.DEFAULT;
}
@Override
@@ -77,21 +77,21 @@ public final class MultiblockRenderHandler {
angle = EnumFacing.SOUTH;
Minecraft mc = Minecraft.getMinecraft();
if(mc.theWorld != null)
dimension = mc.theWorld.provider.getDimension();
if(mc.world != null)
dimension = mc.world.provider.getDimension();
}
@SubscribeEvent
public static void onWorldRenderLast(RenderWorldLastEvent event) {
Minecraft mc = Minecraft.getMinecraft();
if(mc.thePlayer != null && mc.objectMouseOver != null && mc.objectMouseOver.getBlockPos() != null && (!mc.thePlayer.isSneaking() || anchor != null)) {
renderPlayerLook(mc.thePlayer, mc.objectMouseOver);
if(mc.player != null && mc.objectMouseOver != null && mc.objectMouseOver.getBlockPos() != null && (!mc.player.isSneaking() || anchor != null)) {
renderPlayerLook(mc.player, mc.objectMouseOver);
}
}
@SubscribeEvent
public static void onPlayerInteract(PlayerInteractEvent.RightClickBlock event) {
if(currentMultiblock != null && anchor == null && event.getEntityPlayer() == Minecraft.getMinecraft().thePlayer) {
if(currentMultiblock != null && anchor == null && event.getEntityPlayer() == Minecraft.getMinecraft().player) {
anchor = event.getPos();
angle = event.getEntityPlayer().getHorizontalFacing();
event.setCanceled(true);
@@ -99,7 +99,7 @@ public final class MultiblockRenderHandler {
}
private static void renderPlayerLook(EntityPlayer player, RayTraceResult src) {
if(currentMultiblock != null && dimension == player.worldObj.provider.getDimension()) {
if(currentMultiblock != null && dimension == player.world.provider.getDimension()) {
BlockPos anchorPos = anchor != null ? anchor : src.getBlockPos();
GlStateManager.pushMatrix();
@@ -111,7 +111,7 @@ public final class MultiblockRenderHandler {
Multiblock mb = anchor != null ? currentMultiblock.getForFacing(angle) : currentMultiblock.getForEntity(player);
boolean didAny = false;
blockAccess.update(player.worldObj, mb, anchorPos);
blockAccess.update(player.world, mb, anchorPos);
ShaderHelper.useShader(ShaderHelper.alpha, shader -> {
int alpha = ARBShaderObjects.glGetUniformLocationARB(shader, "alpha");
@@ -119,7 +119,7 @@ public final class MultiblockRenderHandler {
});
for(MultiblockComponent comp : mb.getComponents()) {
if(renderComponentInWorld(player.worldObj, mb, comp, anchorPos))
if(renderComponentInWorld(player.world, mb, comp, anchorPos))
didAny = true;
}
@@ -131,7 +131,7 @@ public final class MultiblockRenderHandler {
if(!didAny) {
setMultiblock(null);
player.addChatComponentMessage(new TextComponentTranslation("botaniamisc.structureComplete").setStyle(new Style().setColor(TextFormatting.GREEN)));
player.sendMessage(new TextComponentTranslation("botaniamisc.structureComplete").setStyle(new Style().setColor(TextFormatting.GREEN)));
}
}
}
@@ -56,7 +56,7 @@ public final class RedStringRenderer {
}
public static void tick() {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
EntityPlayer player = Minecraft.getMinecraft().player;
boolean hasWand = player != null && PlayerHelper.hasHeldItem(player, ModItems.twigWand);
if(sizeAlpha > 0F && !hasWand)
sizeAlpha -= 0.1F;
@@ -44,12 +44,12 @@ public class RenderLexicon {
Minecraft mc = Minecraft.getMinecraft();
if(!ConfigHandler.lexicon3dModel
|| mc.gameSettings.thirdPersonView != 0
|| mc.thePlayer.getHeldItem(evt.getHand()) == null
|| mc.thePlayer.getHeldItem(evt.getHand()).getItem() != ModItems.lexicon)
|| mc.player.getHeldItem(evt.getHand()).isEmpty()
|| mc.player.getHeldItem(evt.getHand()).getItem() != ModItems.lexicon)
return;
evt.setCanceled(true);
try {
renderItemInFirstPerson(mc.thePlayer, evt.getPartialTicks(), evt.getInterpolatedPitch(), evt.getHand(), evt.getSwingProgress(), evt.getItemStack(), evt.getEquipProgress());
renderItemInFirstPerson(mc.player, evt.getPartialTicks(), evt.getInterpolatedPitch(), evt.getHand(), evt.getSwingProgress(), evt.getItemStack(), evt.getEquipProgress());
} catch (Throwable throwable) {
Botania.LOGGER.warn("Failed to render lexicon");
}
@@ -61,8 +61,8 @@ public class RenderLexicon {
EnumHandSide enumhandside = flag ? player.getPrimaryHand() : player.getPrimaryHand().opposite();
GlStateManager.pushMatrix();
boolean flag1 = enumhandside == EnumHandSide.RIGHT;
float f = -0.4F * MathHelper.sin(MathHelper.sqrt_float(swingProgress) * (float)Math.PI);
float f1 = 0.2F * MathHelper.sin(MathHelper.sqrt_float(swingProgress) * ((float)Math.PI * 2F));
float f = -0.4F * MathHelper.sin(MathHelper.sqrt(swingProgress) * (float)Math.PI);
float f1 = 0.2F * MathHelper.sin(MathHelper.sqrt(swingProgress) * ((float)Math.PI * 2F));
float f2 = -0.2F * MathHelper.sin(swingProgress * (float)Math.PI);
int i = flag1 ? 1 : -1;
GlStateManager.translate(i * f, f1, f2);
@@ -115,7 +115,7 @@ public class RenderLexicon {
font.drawString(TextFormatting.ITALIC + "" + TextFormatting.BOLD + I18n.format("botaniamisc.edition", ItemLexicon.getEdition()), 0, 0, 0xA07100);
if(quote == -1)
quote = mc.theWorld.rand.nextInt(QUOTES.length);
quote = mc.world.rand.nextInt(QUOTES.length);
String quoteStr = QUOTES[quote];
@@ -159,7 +159,7 @@ public class RenderLexicon {
// End add
float f = MathHelper.sin(p_187453_2_ * p_187453_2_ * (float)Math.PI);
GlStateManager.rotate(i * (45.0F + f * -20.0F), 0.0F, 1.0F, 0.0F);
float f1 = MathHelper.sin(MathHelper.sqrt_float(p_187453_2_) * (float)Math.PI);
float f1 = MathHelper.sin(MathHelper.sqrt(p_187453_2_) * (float)Math.PI);
GlStateManager.rotate(i * f1 * -20.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.rotate(f1 * -80.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(i * -45.0F, 0.0F, 1.0F, 0.0F);
@@ -44,7 +44,8 @@ public final class TooltipAdditionDisplayHandler {
@SubscribeEvent
public static void onToolTipRender(RenderTooltipEvent.PostText evt) {
if(evt.getStack() == null)
// todo this null check is still needed. remove when Forge#3590 is pulled.
if(evt.getStack() == null || evt.getStack().isEmpty())
return;
ItemStack stack = evt.getStack();
@@ -63,11 +64,11 @@ public final class TooltipAdditionDisplayHandler {
EntryData data = LexiconRecipeMappings.getDataForStack(stack);
if(data != null) {
int lexSlot = -1;
ItemStack lexiconStack = null;
ItemStack lexiconStack = ItemStack.EMPTY;
for(int i = 0; i < InventoryPlayer.getHotbarSize(); i++) {
ItemStack stackAt = mc.thePlayer.inventory.getStackInSlot(i);
if(stackAt != null && stackAt.getItem() instanceof ILexicon && ((ILexicon) stackAt.getItem()).isKnowledgeUnlocked(stackAt, data.entry.getKnowledgeType())) {
ItemStack stackAt = mc.player.inventory.getStackInSlot(i);
if(!stackAt.isEmpty() && stackAt.getItem() instanceof ILexicon && ((ILexicon) stackAt.getItem()).isKnowledgeUnlocked(stackAt, data.entry.getKnowledgeType())) {
lexiconStack = stackAt;
lexSlot = i;
break;
@@ -115,11 +116,11 @@ public final class TooltipAdditionDisplayHandler {
GlStateManager.shadeModel(GL11.GL_FLAT);
if(lexiconLookupTime >= time) {
mc.thePlayer.inventory.currentItem = lexSlot;
mc.player.inventory.currentItem = lexSlot;
Botania.proxy.setEntryToOpen(data.entry);
Botania.proxy.setLexiconStack(lexiconStack);
mc.thePlayer.closeScreen();
ItemLexicon.openBook(mc.thePlayer, lexiconStack, mc.theWorld, false);
mc.player.closeScreen();
ItemLexicon.openBook(mc.player, lexiconStack, mc.world, false);
}
} else lexiconLookupTime = 0F;
@@ -21,7 +21,7 @@ public final class TooltipHandler {
@SubscribeEvent(priority = EventPriority.HIGHEST)
public static void onTooltipEvent(ItemTooltipEvent event) {
if(ItemNBTHelper.detectNBT(event.getItemStack()) && ItemNBTHelper.getBoolean(event.getItemStack(), ItemKeepIvy.TAG_KEEP, false))
if(event.getItemStack().hasTagCompound() && ItemNBTHelper.getBoolean(event.getItemStack(), ItemKeepIvy.TAG_KEEP, false))
event.getToolTip().add(I18n.format("botaniamisc.hasKeepIvy"));
}
@@ -25,6 +25,8 @@ import net.minecraft.client.multiplayer.PlayerControllerMP;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
@@ -172,6 +174,17 @@ import vazkii.botania.common.lib.LibObfuscation;
public class ClientProxy implements IProxy {
public static final VertexFormat POSITION_TEX_LMAP_NORMAL =
new VertexFormat()
.addElement(DefaultVertexFormats.POSITION_3F)
.addElement(DefaultVertexFormats.TEX_2F)
.addElement(DefaultVertexFormats.TEX_2S)
.addElement(DefaultVertexFormats.NORMAL_3B);
public static final VertexFormat POSITION_TEX_LMAP =
new VertexFormat()
.addElement(DefaultVertexFormats.POSITION_3F)
.addElement(DefaultVertexFormats.TEX_2F)
.addElement(DefaultVertexFormats.TEX_2S);
public static boolean jingleTheBells = false;
public static boolean dootDoot = false;
@@ -317,23 +330,23 @@ public class ClientProxy implements IProxy {
@Override
public boolean isTheClientPlayer(EntityLivingBase entity) {
return entity == Minecraft.getMinecraft().thePlayer;
return entity == Minecraft.getMinecraft().player;
}
@Override
public EntityPlayer getClientPlayer() {
return Minecraft.getMinecraft().thePlayer;
return Minecraft.getMinecraft().player;
}
@Override
public boolean isClientPlayerWearingMonocle() {
return ItemMonocle.hasMonocle(Minecraft.getMinecraft().thePlayer);
return ItemMonocle.hasMonocle(Minecraft.getMinecraft().player);
}
@Override
public void setExtraReach(EntityLivingBase entity, float reach) {
Minecraft mc = Minecraft.getMinecraft();
EntityPlayer player = mc.thePlayer;
EntityPlayer player = mc.player;
if(entity == player) {
if(!(mc.playerController instanceof IExtendedPlayerController)) {
NetHandlerPlayClient net = ReflectionHelper.getPrivateValue(PlayerControllerMP.class, mc.playerController, LibObfuscation.NET_CLIENT_HANDLER);
@@ -353,7 +366,7 @@ public class ClientProxy implements IProxy {
@Override
public boolean openWikiPage(World world, Block block, RayTraceResult pos) {
IWikiProvider wiki = WikiHooks.getWikiFor(block);
String url = wiki.getWikiURL(world, pos, Minecraft.getMinecraft().thePlayer);
String url = wiki.getWikiURL(world, pos, Minecraft.getMinecraft().player);
if(url != null && !url.isEmpty()) {
try {
Desktop.getDesktop().browse(new URI(url));
@@ -379,17 +392,6 @@ public class ClientProxy implements IProxy {
return s;
}
@Override
public void playRecordClientSided(World world, BlockPos pos, ItemRecord record) {
Minecraft mc = Minecraft.getMinecraft();
if(record == null)
world.playEvent(null, 1010, pos, 0);
else {
world.playEvent(null, 1010, pos, Item.getIdFromItem(record));
mc.ingameGUI.setRecordPlayingMessage(record.getRecordNameLocal());
}
}
@Override
public long getWorldElapsedTicks() {
return ClientTickHandler.ticksInGame;
@@ -441,10 +443,11 @@ public class ClientProxy implements IProxy {
if(!doParticle() && !fake)
return;
FXSparkle sparkle = new FXSparkle(Minecraft.getMinecraft().theWorld, x, y, z, size, r, g, b, m);
sparkle.fake = sparkle.noClip = fake;
FXSparkle sparkle = new FXSparkle(Minecraft.getMinecraft().world, x, y, z, size, r, g, b, m);
sparkle.fake = fake;
sparkle.setCanCollide(!fake);
if(noclipEnabled)
sparkle.noClip = true;
sparkle.setCanCollide(false);
if(corruptSparkle)
sparkle.corrupt = true;
Minecraft.getMinecraft().effectRenderer.addEffect(sparkle);
@@ -468,7 +471,7 @@ public class ClientProxy implements IProxy {
if(!doParticle())
return;
FXWisp wisp = new FXWisp(Minecraft.getMinecraft().theWorld, x, y, z, size, r, g, b, distanceLimit, depthTest, maxAgeMul);
FXWisp wisp = new FXWisp(Minecraft.getMinecraft().world, x, y, z, size, r, g, b, distanceLimit, depthTest, maxAgeMul);
wisp.setSpeed(motionx, motiony, motionz);
Minecraft.getMinecraft().effectRenderer.addEffect(wisp);
}
@@ -491,7 +494,7 @@ public class ClientProxy implements IProxy {
@Override
public void lightningFX(Vector3 vectorStart, Vector3 vectorEnd, float ticksPerMeter, long seed, int colorOuter, int colorInner) {
Minecraft.getMinecraft().effectRenderer.addEffect(new FXLightning(Minecraft.getMinecraft().theWorld, vectorStart, vectorEnd, ticksPerMeter, seed, colorOuter, colorInner));
Minecraft.getMinecraft().effectRenderer.addEffect(new FXLightning(Minecraft.getMinecraft().world, vectorStart, vectorEnd, ticksPerMeter, seed, colorOuter, colorInner));
}
@Override
@@ -180,15 +180,15 @@ public class FXLightning extends Particle {
}
private float rayTraceResistance(Vector3 start, Vector3 end, float prevresistance) {
RayTraceResult mop = worldObj.rayTraceBlocks(start.toVec3D(), end.toVec3D());
RayTraceResult mop = world.rayTraceBlocks(start.toVec3D(), end.toVec3D());
if(mop == null)
return prevresistance;
if(mop.typeOfHit == RayTraceResult.Type.BLOCK) {
Block block = worldObj.getBlockState(mop.getBlockPos()).getBlock();
Block block = world.getBlockState(mop.getBlockPos()).getBlock();
if(worldObj.isAirBlock(mop.getBlockPos()))
if(world.isAirBlock(mop.getBlockPos()))
return prevresistance;
return prevresistance + block.getExplosionResistance(null) + 0.3F;
@@ -46,8 +46,6 @@ public class FXSparkle extends Particle {
private float f4;
private float f5;
public boolean noClip = false;
public FXSparkle(World world, double x, double y, double z, float size, float red, float green, float blue, int m) {
super(world, x, y, z, 0.0D, 0.0D, 0.0D);
@@ -60,7 +58,6 @@ public class FXSparkle extends Particle {
particleScale *= size;
particleMaxAge = 3 * m;
multiplier = m;
noClip = false;
setSize(0.01F, 0.01F);
prevPosX = posX;
prevPosY = posY;
@@ -115,6 +112,10 @@ public class FXSparkle extends Particle {
}
public void setCanCollide(boolean canCollide) {
this.canCollide = canCollide;
}
@Override
public void renderParticle(VertexBuffer worldRendererIn, Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
this.f = f;
@@ -140,19 +141,17 @@ public class FXSparkle extends Particle {
motionY -= 0.04D * particleGravity;
if (!noClip && !fake)
wiggleAround(posX, (getEntityBoundingBox().minY + getEntityBoundingBox().maxY) / 2.0D, posZ);
if (canCollide && !fake)
wiggleAround(posX, (getBoundingBox().minY + getBoundingBox().maxY) / 2.0D, posZ);
posX += motionX;
posY += motionY;
posZ += motionZ;
this.move(motionX, motionY, motionZ);
if (slowdown) {
motionX *= 0.908000001907348633D;
motionY *= 0.908000001907348633D;
motionZ *= 0.908000001907348633D;
if (isCollided) {
if (onGround) {
motionX *= 0.69999998807907104D;
motionZ *= 0.69999998807907104D;
}
@@ -175,59 +174,58 @@ public class FXSparkle extends Particle {
double d2 = z - blockpos.getZ();
// Botania - change collision box list check to !airblock check
if (!worldObj.isAirBlock(blockpos))
if (!world.isAirBlock(blockpos))
{
EnumFacing enumfacing = EnumFacing.UP;
double d3 = Double.MAX_VALUE;
if (!worldObj.isBlockFullCube(blockpos.west()) && d0 < d3)
if (!world.isBlockFullCube(blockpos.west()) && d0 < d3)
{
d3 = d0;
enumfacing = EnumFacing.WEST;
}
if (!worldObj.isBlockFullCube(blockpos.east()) && 1.0D - d0 < d3)
if (!world.isBlockFullCube(blockpos.east()) && 1.0D - d0 < d3)
{
d3 = 1.0D - d0;
enumfacing = EnumFacing.EAST;
}
if (!worldObj.isBlockFullCube(blockpos.north()) && d2 < d3)
if (!world.isBlockFullCube(blockpos.north()) && d2 < d3)
{
d3 = d2;
enumfacing = EnumFacing.NORTH;
}
if (!worldObj.isBlockFullCube(blockpos.south()) && 1.0D - d2 < d3)
if (!world.isBlockFullCube(blockpos.south()) && 1.0D - d2 < d3)
{
d3 = 1.0D - d2;
enumfacing = EnumFacing.SOUTH;
}
if (!worldObj.isBlockFullCube(blockpos.up()) && 1.0D - d1 < d3)
if (!world.isBlockFullCube(blockpos.up()) && 1.0D - d1 < d3)
{
d3 = 1.0D - d1;
enumfacing = EnumFacing.UP;
}
float f = rand.nextFloat() * 0.05F + 0.01F; // Botania - made multiplier and add both smaller
float f = rand.nextFloat() * 0.05F + 0.025F; // Botania - made multiplier and add both smaller
float f1 = enumfacing.getAxisDirection().getOffset();
float secondary = (rand.nextFloat() - rand.nextFloat()) * 0.1F; // Botania - Make and use a secondary movement variable below
if (enumfacing.getAxis() == EnumFacing.Axis.X)
{
motionX += f1 * f;
motionX = f1 * f;
motionY = motionZ = secondary;
}
else if (enumfacing.getAxis() == EnumFacing.Axis.Y)
{
motionY += f1 * f;
motionY = f1 * f;
motionX = motionZ = secondary;
}
else if (enumfacing.getAxis() == EnumFacing.Axis.Z)
{
motionZ += f1 * f;
motionZ = f1 * f;
motionX = motionY = secondary;
}
@@ -140,22 +140,23 @@ public class FXWisp extends Particle {
else queuedDepthIgnoringRenders.add(this);
}
// [VanillaCopy] of super, without drag when onGround is true
@Override
public void onUpdate() {
prevPosX = posX;
prevPosY = posY;
prevPosZ = posZ;
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (particleAge++ >= particleMaxAge)
setExpired();
if (this.particleAge++ >= this.particleMaxAge)
{
this.setExpired();
}
motionY -= 0.04D * particleGravity;
posX += motionX;
posY += motionY;
posZ += motionZ;
motionX *= 0.98000001907348633D;
motionY *= 0.98000001907348633D;
motionZ *= 0.98000001907348633D;
this.motionY -= 0.04D * (double)this.particleGravity;
this.move(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
}
public void setGravity(float value) {
@@ -54,9 +54,10 @@ public class ContainerFlowerBag extends Container {
|| player.getHeldItemOffhand() == flowerBagInv.bag;
}
@Nonnull
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) {
ItemStack itemstack = null;
ItemStack itemstack = ItemStack.EMPTY;
Slot slot = inventorySlots.get(slotIndex);
if(slot != null && slot.getHasStack()) {
@@ -65,24 +66,24 @@ public class ContainerFlowerBag extends Container {
if(slotIndex < 16) {
if(!mergeItemStack(itemstack1, 16, 52, true))
return null;
return ItemStack.EMPTY;
} else {
int i = itemstack.getItemDamage();
if(i < 16) {
Slot slot1 = inventorySlots.get(i);
if(slot1.isItemValid(itemstack) && !mergeItemStack(itemstack1, i, i + 1, true))
return null;
return ItemStack.EMPTY;
}
}
if(itemstack1.stackSize == 0)
slot.putStack(null);
if(itemstack1.isEmpty())
slot.putStack(ItemStack.EMPTY);
else slot.onSlotChanged();
if(itemstack1.stackSize == itemstack.stackSize)
return null;
if(itemstack1.getCount() == itemstack.getCount())
return ItemStack.EMPTY;
slot.onPickupFromSlot(player, itemstack1);
slot.onTake(player, itemstack1);
}
return itemstack;
@@ -52,9 +52,9 @@ public class GuiFlowerBag extends GuiContainer {
if(slot instanceof SlotItemHandler) {
SlotItemHandler slotf = (SlotItemHandler) slot;
if(!slotf.getHasStack()) {
ItemStack stack = new ItemStack(ModBlocks.flower, 0, slotf.getSlotIndex()); // index matches colors
int x = guiLeft + slotf.xDisplayPosition;
int y = guiTop + slotf.yDisplayPosition;
ItemStack stack = new ItemStack(ModBlocks.flower, 1, slotf.getSlotIndex()); // index matches colors
int x = guiLeft + slotf.xPos;
int y = guiTop + slotf.yPos;
RenderHelper.enableGUIStandardItemLighting();
mc.getRenderItem().renderItemIntoGUI(stack, x, y);
RenderHelper.disableStandardItemLighting();
@@ -14,6 +14,8 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandlerModifiable;
import javax.annotation.Nonnull;
public class InventoryFlowerBag implements IItemHandlerModifiable {
private final IItemHandlerModifiable bagInv;
@@ -25,7 +27,7 @@ public class InventoryFlowerBag implements IItemHandlerModifiable {
}
@Override
public void setStackInSlot(int slot, ItemStack stack) {
public void setStackInSlot(int slot, @Nonnull ItemStack stack) {
bagInv.setStackInSlot(slot, stack);
}
@@ -34,18 +36,26 @@ public class InventoryFlowerBag implements IItemHandlerModifiable {
return bagInv.getSlots();
}
@Nonnull
@Override
public ItemStack getStackInSlot(int slot) {
return bagInv.getStackInSlot(slot);
}
@Nonnull
@Override
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) {
return bagInv.insertItem(slot, stack, simulate);
}
@Nonnull
@Override
public ItemStack extractItem(int slot, int amount, boolean simulate) {
return bagInv.extractItem(slot, amount, simulate);
}
@Override
public int getSlotLimit(int slot) {
return bagInv.getSlotLimit(slot);
}
}
@@ -23,10 +23,14 @@ import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.items.SlotItemHandler;
import vazkii.botania.api.mana.IManaItem;
import vazkii.botania.client.gui.SlotLocked;
import java.util.List;
public class ContainerBaubleBox extends Container {
private final InventoryBaubleBox baubleBoxInv;
@@ -74,21 +78,17 @@ public class ContainerBaubleBox extends Container {
|| player.getHeldItemOffhand() == baubleBoxInv.box;
}
@SideOnly(Side.CLIENT)
@Override
public void onContainerClosed(EntityPlayer player) {
super.onContainerClosed(player);
// TODO do we need anything here?
}
@Override
public void putStacksInSlots(ItemStack[] arr) {
public void setAll(List<ItemStack> l) {
baubles.setEventBlock(true);
super.putStacksInSlots(arr);
super.setAll(l);
}
@Nonnull
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) {
ItemStack itemstack = null;
ItemStack itemstack = ItemStack.EMPTY;
Slot slot = inventorySlots.get(slotIndex);
if(slot != null && slot.getHasStack()) {
@@ -101,20 +101,20 @@ public class ContainerBaubleBox extends Container {
if(slotIndex < boxEnd) {
if(!mergeItemStack(itemstack1, boxEnd, invEnd, true))
return null;
return ItemStack.EMPTY;
} else {
if(itemstack1 != null && (itemstack1.getItem() instanceof IBauble || itemstack1.getItem() instanceof IManaItem) && !mergeItemStack(itemstack1, boxStart, boxEnd, false))
return null;
if(!itemstack1.isEmpty() && (itemstack1.getItem() instanceof IBauble || itemstack1.getItem() instanceof IManaItem) && !mergeItemStack(itemstack1, boxStart, boxEnd, false))
return ItemStack.EMPTY;
}
if(itemstack1.stackSize == 0)
slot.putStack(null);
if(itemstack1.isEmpty())
slot.putStack(ItemStack.EMPTY);
else slot.onSlotChanged();
if(itemstack1.stackSize == itemstack.stackSize)
return null;
if(itemstack1.getCount() == itemstack.getCount())
return ItemStack.EMPTY;
slot.onPickupFromSlot(player, itemstack1);
slot.onTake(player, itemstack1);
}
return itemstack;
@@ -36,10 +36,10 @@ public class GuiBaubleBox extends GuiContainer {
for(int i1 = 0; i1 < 7; ++i1) {
Slot slot = inventorySlots.inventorySlots.get(i1);
if(slot.getHasStack() && slot.getSlotStackLimit() == 1)
drawTexturedModalRect(guiLeft+slot.xDisplayPosition, guiTop+slot.yDisplayPosition, 200, 0, 16, 16);
drawTexturedModalRect(guiLeft+slot.xPos, guiTop+slot.yPos, 200, 0, 16, 16);
}
// GuiInventory.drawEntityOnScreen(guiLeft + 43, guiTop + 61, 20, guiLeft + 43 - mouseX, guiTop + 45 - 30 - mouseY, mc.thePlayer);
// GuiInventory.drawEntityOnScreen(guiLeft + 43, guiTop + 61, 20, guiLeft + 43 - mouseX, guiTop + 45 - 30 - mouseY, mc.player);
}
}
@@ -14,6 +14,8 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandlerModifiable;
import javax.annotation.Nonnull;
public class InventoryBaubleBox implements IItemHandlerModifiable {
private final IItemHandlerModifiable boxInv;
@@ -25,7 +27,7 @@ public class InventoryBaubleBox implements IItemHandlerModifiable {
}
@Override
public void setStackInSlot(int slot, ItemStack stack) {
public void setStackInSlot(int slot, @Nonnull ItemStack stack) {
boxInv.setStackInSlot(slot, stack);
}
@@ -34,19 +36,27 @@ public class InventoryBaubleBox implements IItemHandlerModifiable {
return boxInv.getSlots();
}
@Nonnull
@Override
public ItemStack getStackInSlot(int slot) {
return boxInv.getStackInSlot(slot);
}
@Nonnull
@Override
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) {
return boxInv.insertItem(slot, stack, simulate);
}
@Nonnull
@Override
public ItemStack extractItem(int slot, int amount, boolean simulate) {
return boxInv.extractItem(slot, amount, simulate);
}
@Override
public int getSlotLimit(int slot) {
return boxInv.getSlotLimit(slot);
}
}
@@ -76,7 +76,7 @@ import vazkii.botania.common.lib.LibMisc;
public class GuiLexicon extends GuiScreen {
public static GuiLexicon currentOpenLexicon = new GuiLexicon();
public static ItemStack stackUsed;
public static ItemStack stackUsed = ItemStack.EMPTY;
public static final Map<String, String> notes = new HashMap<>();
@@ -291,7 +291,7 @@ public class GuiLexicon extends GuiScreen {
bookmarksNeedPopulation = false;
}
if(mc.thePlayer.getName().equals("haighyorkie")) {
if(mc.player.getName().equals("haighyorkie")) {
GlStateManager.color(1F, 1F, 1F, 1F);
mc.renderEngine.bindTexture(texture);
drawTexturedModalRect(left - 19, top + 42, 67, 180, 19, 26);
@@ -435,7 +435,7 @@ public class GuiLexicon extends GuiScreen {
mc.displayGuiScreen(new GuiBotaniaConfig(this));
break;
case -2 :
mc.displayGuiScreen(new GuiAchievementsHacky(this, mc.thePlayer.getStatFileWriter()));
mc.displayGuiScreen(new GuiAchievementsHacky(this, mc.player.getStatFileWriter()));
break;
case -3 :
mc.displayGuiScreen(new GuiLexiconChallengesList());
@@ -165,7 +165,7 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
String cmd = "/botania-share " + entry.getUnlocalizedName();
mc.ingameGUI.getChatGUI().addToSentMessages(cmd);
mc.thePlayer.sendChatMessage(cmd);
mc.player.sendChatMessage(cmd);
break;
case 4 :
try {
@@ -213,7 +213,7 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
tutorial.poll();
positionTutorialArrow();
if(tutorial.isEmpty()) {
mc.thePlayer.addChatMessage(new TextComponentTranslation("botaniamisc.tutorialEnded").setStyle(new Style().setColor(TextFormatting.RED)));
mc.player.sendMessage(new TextComponentTranslation("botaniamisc.tutorialEnded").setStyle(new Style().setColor(TextFormatting.RED)));
hasTutorialArrow = false;
}
}
@@ -32,7 +32,7 @@ public class GuiButtonInvisible extends GuiButtonLexicon {
private static final ResourceLocation dogResource = new ResourceLocation(LibResources.GUI_DOG);
final GuiLexiconIndex gui;
public ItemStack displayStack = null;
public ItemStack displayStack = ItemStack.EMPTY;
public boolean dog = false;
float timeHover = 0;
@@ -67,7 +67,7 @@ public class GuiButtonInvisible extends GuiButtonLexicon {
hovered = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(hovered);
boolean showStack = displayStack != null && !displayString.isEmpty();
boolean showStack = !displayStack.isEmpty() && !displayString.isEmpty();
if(!displayString.isEmpty() && k == 2) {
timeHover = Math.min(5, timeHover + gui.timeDelta);
@@ -14,7 +14,9 @@ import mezz.jei.api.IJeiHelpers;
import mezz.jei.api.IJeiRuntime;
import mezz.jei.api.IModPlugin;
import mezz.jei.api.IModRegistry;
import mezz.jei.api.ISubtypeRegistry;
import mezz.jei.api.JEIPlugin;
import mezz.jei.api.ingredients.IModIngredientRegistration;
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -41,13 +43,19 @@ import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
@JEIPlugin
public class JEIBotaniaPlugin implements IModPlugin {
@Override
public void registerItemSubtypes(@Nonnull ISubtypeRegistry subtypeRegistry) {
subtypeRegistry.registerSubtypeInterpreter(Item.getItemFromBlock(ModBlocks.specialFlower), ItemBlockSpecialFlower::getType);
subtypeRegistry.registerNbtInterpreter(Item.getItemFromBlock(ModBlocks.floatingSpecialFlower), ItemBlockSpecialFlower::getType);
}
@Override
public void registerIngredients(@Nonnull IModIngredientRegistration registry) {}
@Override
public void register(@Nonnull IModRegistry registry) {
IJeiHelpers jeiHelpers = registry.getJeiHelpers();
jeiHelpers.getSubtypeRegistry().registerNbtInterpreter(Item.getItemFromBlock(ModBlocks.specialFlower), ItemBlockSpecialFlower::getType);
jeiHelpers.getSubtypeRegistry().registerNbtInterpreter(Item.getItemFromBlock(ModBlocks.floatingSpecialFlower), ItemBlockSpecialFlower::getType);
registry.addRecipeCategories(
new BreweryRecipeCategory(jeiHelpers.getGuiHelper()),
new PureDaisyRecipeCategory(jeiHelpers.getGuiHelper()),
@@ -12,11 +12,13 @@ import java.util.Collection;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import mezz.jei.api.IGuiHelper;
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.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
@@ -54,45 +56,37 @@ public class BreweryRecipeCategory implements IRecipeCategory {
return background;
}
@Nullable
@Override
public IDrawable getIcon() {
return null;
}
@Override
public void drawExtras(@Nonnull Minecraft minecraft) {
}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft) {
}
@SuppressWarnings("unchecked")
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
if(!(recipeWrapper instanceof BreweryRecipeWrapper))
return;
BreweryRecipeWrapper wrapper = (BreweryRecipeWrapper) recipeWrapper;
List inputs = wrapper.getInputs();
List<List<ItemStack>> inputs = ingredients.getInputs(ItemStack.class);
recipeLayout.getItemStacks().init(0, true, 39, 41);
if(inputs.get(0) instanceof ItemStack) {
recipeLayout.getItemStacks().set(0, (ItemStack) inputs.get(0));
} else {
recipeLayout.getItemStacks().set(0, (Collection<ItemStack>) inputs.get(0));
}
recipeLayout.getItemStacks().set(0, inputs.get(0));
int index = 1, posX = 60;
for(int i = 1; i < wrapper.getInputs().size(); i++) {
Object o = wrapper.getInputs().get(i);
for(int i = 1; i < inputs.size(); i++) {
List<ItemStack> o = inputs.get(i);
recipeLayout.getItemStacks().init(index, true, posX, 6);
if(o instanceof ItemStack) {
recipeLayout.getItemStacks().set(index, (ItemStack) o);
} else if(o instanceof Collection) {
recipeLayout.getItemStacks().set(index, (Collection<ItemStack>) o);
}
recipeLayout.getItemStacks().set(index, o);
index++;
posX += 18;
}
recipeLayout.getItemStacks().init(7, false, 87, 41);
recipeLayout.getItemStacks().set(7, wrapper.getOutputs());
recipeLayout.getItemStacks().set(7, ingredients.getOutputs(ItemStack.class).get(0));
}
}
@@ -22,16 +22,10 @@ public class BreweryRecipeHandler implements IRecipeHandler<RecipeBrew> {
return RecipeBrew.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid() {
return "botania.brewery";
}
@Nonnull
@Override
public String getRecipeCategoryUid(@Nonnull RecipeBrew recipe) { // o is erased type param
return getRecipeCategoryUid();
return "botania.brewery";
}
@Nonnull
@@ -14,6 +14,7 @@ import javax.annotation.Nonnull;
import com.google.common.collect.ImmutableList;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
@@ -24,16 +25,16 @@ import vazkii.botania.common.item.ModItems;
public class BreweryRecipeWrapper implements IRecipeWrapper {
private final List input;
private final List<List<ItemStack>> input;
private final List<ItemStack> output;
@SuppressWarnings("unchecked")
public BreweryRecipeWrapper(RecipeBrew recipeBrew) {
ImmutableList.Builder builder = ImmutableList.builder();
ImmutableList.Builder<List<ItemStack>> builder = ImmutableList.builder();
builder.add(ImmutableList.of(new ItemStack(ModItems.vial, 1, 0), new ItemStack(ModItems.vial, 1, 1)));
for(Object o : recipeBrew.getInputs()) {
if(o instanceof ItemStack) {
builder.add(o);
builder.add(ImmutableList.of((ItemStack) o));
}
if(o instanceof String) {
builder.add(OreDictionary.getOres((String) o));
@@ -45,33 +46,17 @@ public class BreweryRecipeWrapper implements IRecipeWrapper {
}
@Override
public List getInputs() {
return input;
}
@Override
public List<ItemStack> getOutputs() {
return output;
}
@Override
public List<FluidStack> getFluidInputs() {
return ImmutableList.of();
}
@Override
public List<FluidStack> getFluidOutputs() {
return ImmutableList.of();
public void getIngredients(@Nonnull IIngredients ingredients) {
ingredients.setInputLists(ItemStack.class, input);
ingredients.setOutputLists(ItemStack.class, ImmutableList.of(output));
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
}
@Nonnull
@Override
public List<String> getTooltipStrings(int mouseX, int mouseY) {
return ImmutableList.of();
@@ -9,9 +9,12 @@
package vazkii.botania.client.integration.jei.elventrade;
import java.util.Collection;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import mezz.jei.api.ingredients.IIngredients;
import org.lwjgl.opengl.GL11;
import mezz.jei.api.IGuiHelper;
@@ -62,6 +65,12 @@ public class ElvenTradeRecipeCategory implements IRecipeCategory {
return background;
}
@Nullable
@Override
public IDrawable getIcon() {
return null;
}
@Override
public void drawExtras(@Nonnull Minecraft minecraft) {
GlStateManager.enableAlpha();
@@ -69,10 +78,7 @@ public class ElvenTradeRecipeCategory implements IRecipeCategory {
overlay.draw(minecraft, 0, 4);
GlStateManager.disableBlend();
GlStateManager.disableAlpha();
}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft) {
minecraft.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
TextureAtlasSprite sprite = MiscellaneousIcons.INSTANCE.alfPortalTex;
Tessellator tess = Tessellator.getInstance();
@@ -89,29 +95,23 @@ public class ElvenTradeRecipeCategory implements IRecipeCategory {
tess.draw();
}
@SuppressWarnings("unchecked")
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
if(!(recipeWrapper instanceof ElvenTradeRecipeWrapper))
return;
ElvenTradeRecipeWrapper wrapper = (ElvenTradeRecipeWrapper) recipeWrapper;
int index = 0, posX = 42;
for(Object o : wrapper.getInputs()) {
for(List<ItemStack> o : ingredients.getInputs(ItemStack.class)) {
recipeLayout.getItemStacks().init(index, true, posX, 0);
if(o instanceof Collection) {
recipeLayout.getItemStacks().set(index, (Collection<ItemStack>) o);
} else {
recipeLayout.getItemStacks().set(index, (ItemStack) o);
}
recipeLayout.getItemStacks().set(index, o);
index++;
posX += 18;
}
for (int i = 0; i < wrapper.getOutputs().size(); i++) {
ItemStack stack = wrapper.getOutputs().get(i);
for (int i = 0; i < ingredients.getOutputs(ItemStack.class).size(); i++) {
List<ItemStack> stacks = ingredients.getOutputs(ItemStack.class).get(i);
recipeLayout.getItemStacks().init(index + i, false, 93 + i % 2 * 20, 41 + i / 2 * 20);
recipeLayout.getItemStacks().set(index + i, stack);
recipeLayout.getItemStacks().set(index + i, stacks);
}
}
@@ -22,16 +22,10 @@ public class ElvenTradeRecipeHandler implements IRecipeHandler<RecipeElvenTrade>
return RecipeElvenTrade.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid() {
return "botania.elvenTrade";
}
@Nonnull
@Override
public String getRecipeCategoryUid(@Nonnull RecipeElvenTrade recipe) { // o is erased type param
return getRecipeCategoryUid();
return "botania.elvenTrade";
}
@Nonnull
@@ -14,6 +14,7 @@ import javax.annotation.Nonnull;
import com.google.common.collect.ImmutableList;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
@@ -23,15 +24,15 @@ import vazkii.botania.api.recipe.RecipeElvenTrade;
public class ElvenTradeRecipeWrapper implements IRecipeWrapper {
private final List input;
private final List<List<ItemStack>> input;
private final List<ItemStack> outputs;
@SuppressWarnings("unchecked")
public ElvenTradeRecipeWrapper(RecipeElvenTrade recipe) {
ImmutableList.Builder builder = ImmutableList.builder();
ImmutableList.Builder<List<ItemStack>> builder = ImmutableList.builder();
for(Object o : recipe.getInputs()) {
if(o instanceof ItemStack) {
builder.add(o);
builder.add(ImmutableList.of((ItemStack) o));
}
if(o instanceof String) {
builder.add(OreDictionary.getOres((String) o));
@@ -42,33 +43,15 @@ public class ElvenTradeRecipeWrapper implements IRecipeWrapper {
}
@Override
public List getInputs() {
return input;
public void getIngredients(@Nonnull IIngredients ingredients) {
ingredients.setInputLists(ItemStack.class, input);
ingredients.setOutputs(ItemStack.class, outputs);
}
@Override
public List<ItemStack> getOutputs() {
return outputs;
}
@Override
public List<FluidStack> getFluidInputs() {
return ImmutableList.of();
}
@Override
public List<FluidStack> getFluidOutputs() {
return ImmutableList.of();
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
}
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {}
@Nonnull
@Override
public List<String> getTooltipStrings(int mouseX, int mouseY) {
return ImmutableList.of();
@@ -11,10 +11,12 @@ package vazkii.botania.client.integration.jei.manapool;
import java.util.Collection;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
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.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
@@ -59,6 +61,12 @@ public class ManaPoolRecipeCategory implements IRecipeCategory {
return background;
}
@Nullable
@Override
public IDrawable getIcon() {
return null;
}
@Override
public void drawExtras(@Nonnull Minecraft minecraft) {
GlStateManager.enableAlpha();
@@ -69,31 +77,21 @@ public class ManaPoolRecipeCategory implements IRecipeCategory {
}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft) {
}
@SuppressWarnings("unchecked")
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
if(!(recipeWrapper instanceof ManaPoolRecipeWrapper))
return;
ManaPoolRecipeWrapper wrapper = (ManaPoolRecipeWrapper) recipeWrapper;
int index = 0;
recipeLayout.getItemStacks().init(index, true, 40, 12);
if(wrapper.getInputs().get(0) instanceof Collection) {
recipeLayout.getItemStacks().set(index, (Collection<ItemStack>) wrapper.getInputs().get(0));
} else {
recipeLayout.getItemStacks().set(index, (ItemStack) wrapper.getInputs().get(0));
}
recipeLayout.getItemStacks().set(index, ingredients.getInputs(ItemStack.class).get(0));
index++;
if(wrapper.getInputs().size() > 1) {
if(ingredients.getInputs(ItemStack.class).size() > 1) {
// Has catalyst
recipeLayout.getItemStacks().init(index, true, 20, 12);
recipeLayout.getItemStacks().set(index, (ItemStack) wrapper.getInputs().get(1));
recipeLayout.getItemStacks().set(index, ingredients.getInputs(ItemStack.class).get(1));
index++;
}
@@ -102,11 +100,7 @@ public class ManaPoolRecipeCategory implements IRecipeCategory {
index++;
recipeLayout.getItemStacks().init(index, false, 99, 12);
if(wrapper.getOutputs().get(0) instanceof Collection) {
recipeLayout.getItemStacks().set(index, (Collection<ItemStack>) wrapper.getOutputs().get(0));
} else {
recipeLayout.getItemStacks().set(index, (ItemStack) wrapper.getOutputs().get(0));
}
recipeLayout.getItemStacks().set(index, ingredients.getOutputs(ItemStack.class).get(0));
}
}
@@ -22,16 +22,10 @@ public class ManaPoolRecipeHandler implements IRecipeHandler<RecipeManaInfusion>
return RecipeManaInfusion.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid() {
return "botania.manaPool";
}
@Nonnull
@Override
public String getRecipeCategoryUid(@Nonnull RecipeManaInfusion recipe) { // o is erased type param
return getRecipeCategoryUid();
return "botania.manaPool";
}
@Nonnull
@@ -15,10 +15,12 @@ import javax.annotation.Nullable;
import com.google.common.collect.ImmutableList;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
@@ -29,23 +31,23 @@ import vazkii.botania.common.block.tile.mana.TilePool;
public class ManaPoolRecipeWrapper implements IRecipeWrapper {
private final List input;
private final List<List<ItemStack>> input;
private final ItemStack output;
private final int mana;
public ManaPoolRecipeWrapper(RecipeManaInfusion recipe) {
ImmutableList.Builder<Object> builder = ImmutableList.builder();
ImmutableList.Builder<List<ItemStack>> builder = ImmutableList.builder();
if(recipe.getInput() instanceof ItemStack) {
builder.add(recipe.getInput());
builder.add(ImmutableList.of((ItemStack) recipe.getInput()));
} else if(recipe.getInput() instanceof String) {
builder.add(OreDictionary.getOres((String) recipe.getInput()));
}
if(recipe.getCatalyst() != null) {
Block block = recipe.getCatalyst().getBlock();
if (Item.getItemFromBlock(block) != null) {
builder.add(new ItemStack(block, 1, block.getMetaFromState(recipe.getCatalyst())));
if (Item.getItemFromBlock(block) != Items.AIR) {
builder.add(ImmutableList.of(new ItemStack(block, 1, block.getMetaFromState(recipe.getCatalyst()))));
}
}
@@ -55,23 +57,9 @@ public class ManaPoolRecipeWrapper implements IRecipeWrapper {
}
@Override
public List getInputs() {
return input;
}
@Override
public List getOutputs() {
return ImmutableList.of(output);
}
@Override
public List<FluidStack> getFluidInputs() {
return ImmutableList.of();
}
@Override
public List<FluidStack> getFluidOutputs() {
return ImmutableList.of();
public void getIngredients(@Nonnull IIngredients ingredients) {
ingredients.setInputLists(ItemStack.class, input);
ingredients.setOutput(ItemStack.class, output);
}
@Override
@@ -81,11 +69,7 @@ public class ManaPoolRecipeWrapper implements IRecipeWrapper {
GlStateManager.disableAlpha();
}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
}
@Nullable
@Nonnull
@Override
public List<String> getTooltipStrings(int mouseX, int mouseY) {
return ImmutableList.of();
@@ -10,13 +10,16 @@ package vazkii.botania.client.integration.jei.petalapothecary;
import java.awt.Point;
import java.util.Collection;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import mezz.jei.api.IGuiHelper;
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.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
@@ -58,6 +61,12 @@ public class PetalApothecaryRecipeCategory implements IRecipeCategory {
return background;
}
@Nullable
@Override
public IDrawable getIcon() {
return null;
}
@Override
public void drawExtras(@Nonnull Minecraft minecraft) {
GlStateManager.enableAlpha();
@@ -68,37 +77,26 @@ public class PetalApothecaryRecipeCategory implements IRecipeCategory {
}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft) {
}
@SuppressWarnings("unchecked")
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
if(!(recipeWrapper instanceof PetalApothecaryRecipeWrapper))
return;
PetalApothecaryRecipeWrapper wrapper = (PetalApothecaryRecipeWrapper) recipeWrapper;
recipeLayout.getItemStacks().init(0, true, 64, 52);
recipeLayout.getItemStacks().set(0, new ItemStack(ModBlocks.altar));
int index = 1;
double angleBetweenEach = 360.0 / wrapper.getInputs().size();
double angleBetweenEach = 360.0 / ingredients.getInputs(ItemStack.class).size();
Point point = new Point(64, 20), center = new Point(64, 52);
for(Object o : wrapper.getInputs()) {
for(List<ItemStack> o : ingredients.getInputs(ItemStack.class)) {
recipeLayout.getItemStacks().init(index, true, point.x, point.y);
if(o instanceof Collection) {
recipeLayout.getItemStacks().set(index, (Collection<ItemStack>) o);
}
if(o instanceof ItemStack) {
recipeLayout.getItemStacks().set(index, (ItemStack) o);
}
recipeLayout.getItemStacks().set(index, o);
index += 1;
point = rotatePointAbout(point, center, angleBetweenEach);
}
recipeLayout.getItemStacks().init(index, false, 103, 17);
recipeLayout.getItemStacks().set(index, wrapper.getOutputs().get(0));
recipeLayout.getItemStacks().set(index, ingredients.getOutputs(ItemStack.class).get(0));
}
private Point rotatePointAbout(Point in, Point about, double degrees) {
@@ -22,16 +22,10 @@ public class PetalApothecaryRecipeHandler implements IRecipeHandler<RecipePetals
return RecipePetals.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid() {
return "botania.petals";
}
@Nonnull
@Override
public String getRecipeCategoryUid(@Nonnull RecipePetals recipe) { // o is erased type param
return getRecipeCategoryUid();
return "botania.petals";
}
@Nonnull
@@ -14,6 +14,7 @@ import javax.annotation.Nonnull;
import com.google.common.collect.ImmutableList;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
@@ -23,14 +24,14 @@ import vazkii.botania.api.recipe.RecipePetals;
public class PetalApothecaryRecipeWrapper implements IRecipeWrapper {
private final List input;
private final List<List<ItemStack>> input;
private final ItemStack output;
public PetalApothecaryRecipeWrapper(RecipePetals recipe) {
ImmutableList.Builder<Object> builder = ImmutableList.builder();
ImmutableList.Builder<List<ItemStack>> builder = ImmutableList.builder();
for(Object o : recipe.getInputs()) {
if(o instanceof ItemStack) {
builder.add(o);
builder.add(ImmutableList.of((ItemStack) o));
}
if(o instanceof String) {
builder.add(OreDictionary.getOres((String) o));
@@ -41,33 +42,16 @@ public class PetalApothecaryRecipeWrapper implements IRecipeWrapper {
}
@Override
public List getInputs() {
return input;
}
@Override
public List<ItemStack> getOutputs() {
return ImmutableList.of(output);
}
@Override
public List<FluidStack> getFluidInputs() {
return ImmutableList.of();
}
@Override
public List<FluidStack> getFluidOutputs() {
return ImmutableList.of();
public void getIngredients(@Nonnull IIngredients ingredients) {
ingredients.setInputLists(ItemStack.class, input);
ingredients.setOutput(ItemStack.class, output);
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
}
@Nonnull
@Override
public List<String> getTooltipStrings(int mouseX, int mouseY) {
return ImmutableList.of();
@@ -11,10 +11,12 @@ package vazkii.botania.client.integration.jei.puredaisy;
import java.util.Collection;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
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.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
@@ -22,6 +24,7 @@ import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
import vazkii.botania.common.lib.LibBlockNames;
@@ -57,6 +60,12 @@ public class PureDaisyRecipeCategory implements IRecipeCategory {
return background;
}
@Nullable
@Override
public IDrawable getIcon() {
return null;
}
@Override
public void drawExtras(@Nonnull Minecraft minecraft) {
GlStateManager.enableAlpha();
@@ -67,30 +76,19 @@ public class PureDaisyRecipeCategory implements IRecipeCategory {
}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft) {
}
@SuppressWarnings("unchecked")
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
if(!(recipeWrapper instanceof PureDaisyRecipeWrapper))
return;
PureDaisyRecipeWrapper wrapper = (PureDaisyRecipeWrapper) recipeWrapper;
boolean inputFluid = wrapper.getInputs().isEmpty();
boolean outputFluid = wrapper.getOutputs().isEmpty();
boolean inputFluid = !ingredients.getInputs(FluidStack.class).isEmpty();
boolean outputFluid = !ingredients.getOutputs(FluidStack.class).isEmpty();
if(inputFluid) {
recipeLayout.getFluidStacks().init(0, true, 40, 12, 16, 16, 1000, false, null);
recipeLayout.getFluidStacks().set(0, wrapper.getFluidInputs().get(0));
recipeLayout.getFluidStacks().set(0, ingredients.getInputs(FluidStack.class).get(0));
} else {
recipeLayout.getItemStacks().init(0, true, 40, 12);
if(wrapper.getInputs().get(0) instanceof Collection) {
recipeLayout.getItemStacks().set(0, (Collection<ItemStack>) wrapper.getInputs().get(0));
} else {
recipeLayout.getItemStacks().set(0, (ItemStack) wrapper.getInputs().get(0));
}
recipeLayout.getItemStacks().set(0, ingredients.getInputs(ItemStack.class).get(0));
}
recipeLayout.getItemStacks().init(1, true, 70, 12);
@@ -98,14 +96,10 @@ public class PureDaisyRecipeCategory implements IRecipeCategory {
if(outputFluid) {
recipeLayout.getFluidStacks().init(2, false, 99, 12, 16, 16, 1000, false, null);
recipeLayout.getFluidStacks().set(2, wrapper.getFluidOutputs().get(0));
recipeLayout.getFluidStacks().set(2, ingredients.getOutputs(FluidStack.class).get(0));
} else {
recipeLayout.getItemStacks().init(2, false, 99, 12);
if(wrapper.getOutputs().get(0) instanceof Collection) {
recipeLayout.getItemStacks().set(2, (Collection<ItemStack>) wrapper.getOutputs().get(0));
} else {
recipeLayout.getItemStacks().set(2, (ItemStack) wrapper.getOutputs().get(0));
}
recipeLayout.getItemStacks().set(2, ingredients.getOutputs(ItemStack.class).get(0));
}
}
@@ -22,16 +22,10 @@ public class PureDaisyRecipeHandler implements IRecipeHandler<RecipePureDaisy> {
return RecipePureDaisy.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid() {
return "botania.pureDaisy";
}
@Nonnull
@Override
public String getRecipeCategoryUid(@Nonnull RecipePureDaisy recipe) { // o is erased type param
return getRecipeCategoryUid();
return "botania.pureDaisy";
}
@Nonnull
@@ -14,6 +14,7 @@ import javax.annotation.Nonnull;
import com.google.common.collect.ImmutableList;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
@@ -25,18 +26,18 @@ import vazkii.botania.api.recipe.RecipePureDaisy;
public class PureDaisyRecipeWrapper implements IRecipeWrapper {
private List inputs = ImmutableList.of();
private List outputs = ImmutableList.of();
private List<FluidStack> fluidInputs = ImmutableList.of();
private List<FluidStack> fluidOutputs = ImmutableList.of();
private List<ItemStack> inputs = ImmutableList.of();
private ItemStack output = ItemStack.EMPTY;
private FluidStack fluidInput = null;
private FluidStack fluidOutput = null;
public PureDaisyRecipeWrapper(RecipePureDaisy recipe) {
if(recipe.getInput() instanceof String) {
inputs = ImmutableList.of(OreDictionary.getOres((String) recipe.getInput()));
inputs = ImmutableList.copyOf(OreDictionary.getOres((String) recipe.getInput()));
} else if(recipe.getInput() instanceof Block) {
Block b = (Block) recipe.getInput();
if(FluidRegistry.lookupFluidForBlock(b) != null) {
fluidInputs = ImmutableList.of(new FluidStack(FluidRegistry.lookupFluidForBlock(b), 1000));
fluidInput = new FluidStack(FluidRegistry.lookupFluidForBlock(b), 1000);
} else {
inputs = ImmutableList.of(new ItemStack(b, 1, b.getMetaFromState(b.getDefaultState())));
}
@@ -44,40 +45,34 @@ public class PureDaisyRecipeWrapper implements IRecipeWrapper {
Block outBlock = recipe.getOutputState().getBlock();
if(FluidRegistry.lookupFluidForBlock(outBlock) != null) {
fluidOutputs = ImmutableList.of(new FluidStack(FluidRegistry.lookupFluidForBlock(outBlock), 1000));
fluidOutput = new FluidStack(FluidRegistry.lookupFluidForBlock(outBlock), 1000);
} else {
outputs = ImmutableList.of(new ItemStack(outBlock, 1, outBlock.getMetaFromState(recipe.getOutputState())));
output = new ItemStack(outBlock, 1, outBlock.getMetaFromState(recipe.getOutputState()));
}
}
@Override
public List getInputs() {
return inputs;
}
public void getIngredients(@Nonnull IIngredients ingredients) {
ingredients.setInputs(ItemStack.class, inputs);
@Override
public List getOutputs() {
return outputs;
}
if (fluidInput != null) {
ingredients.setInput(FluidStack.class, fluidInput);
}
@Override
public List<FluidStack> getFluidInputs() {
return fluidInputs;
}
if (!output.isEmpty()) {
ingredients.setOutput(ItemStack.class, output);
}
@Override
public List<FluidStack> getFluidOutputs() {
return fluidOutputs;
if (fluidOutput != null) {
ingredients.setOutput(FluidStack.class, fluidOutput);
}
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
}
@Nonnull
@Override
public List<String> getTooltipStrings(int mouseX, int mouseY) {
return ImmutableList.of();
@@ -10,12 +10,15 @@ package vazkii.botania.client.integration.jei.runicaltar;
import java.awt.Point;
import java.util.Collection;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
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.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
@@ -57,6 +60,12 @@ public class RunicAltarRecipeCategory implements IRecipeCategory {
return background;
}
@Nullable
@Override
public IDrawable getIcon() {
return null;
}
@Override
public void drawExtras(@Nonnull Minecraft minecraft) {
GlStateManager.enableAlpha();
@@ -67,12 +76,7 @@ public class RunicAltarRecipeCategory implements IRecipeCategory {
}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft) {
}
@SuppressWarnings("unchecked")
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
if(!(recipeWrapper instanceof RunicAltarRecipeWrapper))
return;
RunicAltarRecipeWrapper wrapper = (RunicAltarRecipeWrapper) recipeWrapper;
@@ -81,23 +85,19 @@ public class RunicAltarRecipeCategory implements IRecipeCategory {
recipeLayout.getItemStacks().set(0, new ItemStack(ModBlocks.runeAltar));
int index = 1;
double angleBetweenEach = 360.0 / wrapper.getInputs().size();
double angleBetweenEach = 360.0 / ingredients.getInputs(ItemStack.class).size();
Point point = new Point(64, 20), center = new Point(64, 52);
for(Object o : wrapper.getInputs()) {
for(List<ItemStack> o : ingredients.getInputs(ItemStack.class)) {
recipeLayout.getItemStacks().init(index, true, point.x, point.y);
if(o instanceof Collection) {
recipeLayout.getItemStacks().set(index, (Collection<ItemStack>) o);
}
if(o instanceof ItemStack) {
recipeLayout.getItemStacks().set(index, (ItemStack) o);
}
recipeLayout.getItemStacks().set(index, o);
index += 1;
point = rotatePointAbout(point, center, angleBetweenEach);
}
recipeLayout.getItemStacks().init(index, false, 103, 17);
recipeLayout.getItemStacks().set(index, wrapper.getOutputs().get(0));
recipeLayout.getItemStacks().set(index, ingredients.getOutputs(ItemStack.class).get(0));
}
private Point rotatePointAbout(Point in, Point about, double degrees) {
@@ -22,16 +22,10 @@ public class RunicAltarRecipeHandler implements IRecipeHandler<RecipeRuneAltar>
return RecipeRuneAltar.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid() {
return "botania.runicAltar";
}
@Nonnull
@Override
public String getRecipeCategoryUid(@Nonnull RecipeRuneAltar recipe) { // o is erased type param
return getRecipeCategoryUid();
return "botania.runicAltar";
}
@Nonnull
@@ -14,6 +14,7 @@ import javax.annotation.Nonnull;
import com.google.common.collect.ImmutableList;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
@@ -26,16 +27,16 @@ import vazkii.botania.common.block.tile.mana.TilePool;
public class RunicAltarRecipeWrapper implements IRecipeWrapper {
private final List input;
private final List<List<ItemStack>> input;
private final ItemStack output;
private final int manaUsage;
@SuppressWarnings("unchecked")
public RunicAltarRecipeWrapper(RecipeRuneAltar recipe) {
ImmutableList.Builder builder = ImmutableList.builder();
ImmutableList.Builder<List<ItemStack>> builder = ImmutableList.builder();
for(Object o : recipe.getInputs()) {
if(o instanceof ItemStack) {
builder.add(o);
builder.add(ImmutableList.of((ItemStack) o));
}
if(o instanceof String) {
builder.add(OreDictionary.getOres((String) o));
@@ -47,23 +48,9 @@ public class RunicAltarRecipeWrapper implements IRecipeWrapper {
}
@Override
public List getInputs() {
return input;
}
@Override
public List<ItemStack> getOutputs() {
return ImmutableList.of(output);
}
@Override
public List<FluidStack> getFluidInputs() {
return ImmutableList.of();
}
@Override
public List<FluidStack> getFluidOutputs() {
return ImmutableList.of();
public void getIngredients(@Nonnull IIngredients ingredients) {
ingredients.setInputLists(ItemStack.class, input);
ingredients.setOutput(ItemStack.class, output);
}
@Override
@@ -73,10 +60,7 @@ public class RunicAltarRecipeWrapper implements IRecipeWrapper {
GlStateManager.disableAlpha();
}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
}
@Nonnull
@Override
public List<String> getTooltipStrings(int mouseX, int mouseY) {
return ImmutableList.of();
@@ -10,9 +10,11 @@
*/
package vazkii.botania.client.lib;
import vazkii.botania.common.lib.LibMisc;
public final class LibResources {
public static final String PREFIX_MOD = "botania:";
public static final String PREFIX_MOD = LibMisc.MOD_ID + ":";
public static final String PREFIX_LANG = "/assets/botania/lang/";
public static final String PREFIX_SHADER = "/assets/botania/shader/";
@@ -218,7 +218,7 @@ public class FloatingFlowerModel implements IBakedModel {
private final ItemOverrideList itemHandler = new ItemOverrideList(ImmutableList.of()) {
@Nonnull
@Override
public IBakedModel handleItemState(@Nonnull IBakedModel model, ItemStack stack, @Nonnull World world, @Nonnull EntityLivingBase entity) {
public IBakedModel handleItemState(@Nonnull IBakedModel model, ItemStack stack, World world, EntityLivingBase entity) {
// Items always have GRASS island
IFloatingFlower.IslandType islandType = IFloatingFlower.IslandType.GRASS;
String identifier;
@@ -49,9 +49,9 @@ public class GunModel implements IBakedModel {
private final ItemOverrideList itemHandler = new ItemOverrideList(ImmutableList.of()) {
@Nonnull
@Override
public IBakedModel handleItemState(@Nonnull IBakedModel model, ItemStack stack, @Nonnull World world, @Nonnull EntityLivingBase entity) {
public IBakedModel handleItemState(@Nonnull IBakedModel model, ItemStack stack, World world, EntityLivingBase entity) {
ItemStack lens = ItemManaGun.getLens(stack);
if(lens != null) {
if(!lens.isEmpty()) {
IBakedModel lensModel = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel(lens);
return GunModel.this.getModel(lensModel);
}
@@ -55,7 +55,7 @@ public class ModelBrewery extends ModelBase {
GlStateManager.translate(0F, offset, 0F);
GlStateManager.rotate(polerot, 0F, 1F, 0F);
if(hasTile && render.brewery.getItemHandler().getStackInSlot(0) != null) {
if(hasTile && !render.brewery.getItemHandler().getStackInSlot(0).isEmpty()) {
GlStateManager.rotate(180F, 1F, 0F, 0F);
GlStateManager.translate(0, -0.45, 0);
//GlStateManager.translate(-1F / 8F, -0.5F, 1F / 128F);
@@ -78,7 +78,7 @@ public class ModelBrewery extends ModelBase {
offset1 = 0F;
GlStateManager.translate(0F, offset1, 0F);
if(hasTile && render.brewery.getItemHandler().getStackInSlot(i + 1) != null) {
if(hasTile && !render.brewery.getItemHandler().getStackInSlot(i + 1).isEmpty()) {
float rot = Plate.rotateAngleY * 180F / (float) Math.PI;
float transX = 0.3125F;
float transY = 1.06F;
@@ -43,7 +43,7 @@ public class ModelTeruTeruBozu extends ModelBase {
public void render() {
float f5 = 1F / 16F;
if(Minecraft.getMinecraft().theWorld.isRaining())
if(Minecraft.getMinecraft().world.isRaining())
sadFace.render(f5);
else happyFace.render(f5);
thread.render(f5);
@@ -148,8 +148,8 @@ public class PlatformModel implements IBakedModel {
@Nonnull
@Override
public Biome getBiomeGenForCoords(@Nonnull BlockPos pos) {
return compose.getBiomeGenForCoords(pos);
public Biome getBiome(@Nonnull BlockPos pos) {
return compose.getBiome(pos);
}
@Override
@@ -147,9 +147,9 @@ public class SpecialFlowerModel implements IModelCustomData {
@Override
public boolean accepts(ResourceLocation modelLocation) {
return modelLocation.getResourceDomain().equals("botania_special") && (
modelLocation.getResourcePath().equals("specialFlower") ||
modelLocation.getResourcePath().equals("models/block/specialFlower") ||
modelLocation.getResourcePath().equals("models/item/specialFlower"));
modelLocation.getResourcePath().equals("specialflower") ||
modelLocation.getResourcePath().equals("models/block/specialflower") ||
modelLocation.getResourcePath().equals("models/item/specialflower"));
}
@Override
@@ -239,7 +239,7 @@ public class SpecialFlowerModel implements IModelCustomData {
private final ItemOverrideList itemHandler = new ItemOverrideList(ImmutableList.of()) {
@Nonnull
@Override
public IBakedModel handleItemState(@Nonnull IBakedModel original, ItemStack stack, @Nonnull World world, @Nonnull EntityLivingBase living) {
public IBakedModel handleItemState(@Nonnull IBakedModel original, ItemStack stack, World world, EntityLivingBase living) {
Optional<IBakedModel> item = bakedItemModels.getUnchecked(ItemBlockSpecialFlower.getType(stack));
if(!item.isPresent())
@@ -30,7 +30,7 @@ public class LayerGaiaHead implements LayerRenderer<EntityPlayer> {
public void doRenderLayer(@Nonnull EntityPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
ItemStack itemstack = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
if (itemstack != null && itemstack.getItem() == ModItems.gaiaHead) // Botania - check for head
if (!itemstack.isEmpty() && itemstack.getItem() == ModItems.gaiaHead) // Botania - check for head
{
GlStateManager.pushMatrix();
@@ -30,11 +30,6 @@ public class RenderCorporeaSpark extends RenderSparkBase<EntityCorporeaSpark> {
super(manager);
}
@Override
protected DataParameter<Integer> getInvisibilityParam() {
return EntityCorporeaSpark.INVISIBILITY;
}
@Override
public TextureAtlasSprite getBaseIcon(EntityCorporeaSpark entity) {
return entity.isMaster() ? MiscellaneousIcons.INSTANCE.corporeaWorldIconMaster : MiscellaneousIcons.INSTANCE.corporeaWorldIcon;
@@ -62,8 +57,8 @@ public class RenderCorporeaSpark extends RenderSparkBase<EntityCorporeaSpark> {
float absTime = Math.abs(time) - pticks;
ItemStack stack = entity.getDisplayedItem().orNull();
if(stack == null)
ItemStack stack = entity.getDisplayedItem();
if(stack.isEmpty())
return;
GlStateManager.pushMatrix();
@@ -76,7 +71,7 @@ public class RenderCorporeaSpark extends RenderSparkBase<EntityCorporeaSpark> {
GlStateManager.translate(0F, 0F, -2F + (time < 0 ? -absTime : absTime) / 6);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
TextureAtlasSprite icon = Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides(stack, entity.worldObj, null).getParticleTexture();
TextureAtlasSprite icon = Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides(stack, entity.world, null).getParticleTexture();
if(icon != null) {
float minU = icon.getMinU();
@@ -22,11 +22,6 @@ public class RenderSpark extends RenderSparkBase<EntitySpark> {
super(renderManager);
}
@Override
protected DataParameter<Integer> getInvisibilityParam() {
return EntitySpark.INVISIBILITY;
}
@Override
public TextureAtlasSprite getSpinningIcon(EntitySpark entity) {
int upgrade = entity.getUpgrade().ordinal() - 1;
@@ -22,12 +22,12 @@ import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.network.datasync.DataParameter;
import net.minecraft.util.ResourceLocation;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.core.handler.MiscellaneousIcons;
import vazkii.botania.client.core.proxy.ClientProxy;
public abstract class RenderSparkBase<T extends Entity> extends Render<T> {
@@ -49,7 +49,7 @@ public abstract class RenderSparkBase<T extends Entity> extends Render<T> {
double time = ClientTickHandler.ticksInGame + par9;
time += new Random(tEntity.getEntityId()).nextInt();
float a = 0.1F + (1 - tEntity.getDataManager().get(getInvisibilityParam())) * 0.8F;
float a = 0.1F + (tEntity.isInvisible() ? 0 : 1) * 0.8F;
GlStateManager.color(1F, 1F, 1F, (0.7F + 0.3F * (float) (Math.sin(time / 5.0) + 0.5) * 2) * a);
@@ -62,14 +62,14 @@ public abstract class RenderSparkBase<T extends Entity> extends Render<T> {
float r = 180.0F - renderManager.playerViewY;
GlStateManager.rotate(r, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(-renderManager.playerViewX, 1F, 0F, 0F);
func_77026_a(tessellator, iicon);
renderIcon(tessellator, iicon);
TextureAtlasSprite spinningIcon = getSpinningIcon(tEntity);
if(spinningIcon != null) {
GlStateManager.translate(-0.02F + (float) Math.sin(time / 20) * 0.2F, 0.24F + (float) Math.cos(time / 20) * 0.2F, 0.005F);
GlStateManager.scale(0.2F, 0.2F, 0.2F);
colorSpinningIcon(tEntity, a);
func_77026_a(tessellator, spinningIcon);
renderIcon(tessellator, spinningIcon);
}
GlStateManager.popMatrix();
GlStateManager.color(1F, 1F, 1F, 1F);
@@ -80,8 +80,6 @@ public abstract class RenderSparkBase<T extends Entity> extends Render<T> {
GlStateManager.popMatrix();
}
protected abstract DataParameter<Integer> getInvisibilityParam();
protected TextureAtlasSprite getBaseIcon(T entity) {
return MiscellaneousIcons.INSTANCE.sparkWorldIcon;
}
@@ -100,22 +98,21 @@ public abstract class RenderSparkBase<T extends Entity> extends Render<T> {
return TextureMap.LOCATION_BLOCKS_TEXTURE;
}
private void func_77026_a(Tessellator p_77026_1_, TextureAtlasSprite p_77026_2_) {
float f = p_77026_2_.getMinU();
float f1 = p_77026_2_.getMaxU();
float f2 = p_77026_2_.getMinV();
float f3 = p_77026_2_.getMaxV();
private void renderIcon(Tessellator tess, TextureAtlasSprite icon) {
float f = icon.getMinU();
float f1 = icon.getMaxU();
float f2 = icon.getMinV();
float f3 = icon.getMaxV();
float f4 = 1.0F;
float f5 = 0.5F;
float f6 = 0.25F;
p_77026_1_.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_NORMAL);
//p_77026_1_.getBuffer().setBrightness(240);
p_77026_1_.getBuffer().pos(0.0F - f5, 0.0F - f6, 0.0D).tex(f, f3).normal(0.0F, 1.0F, 0.0F).endVertex();
p_77026_1_.getBuffer().pos(f4 - f5, 0.0F - f6, 0.0D).tex(f1, f3).normal(0.0F, 1.0F, 0.0F).endVertex();
p_77026_1_.getBuffer().pos(f4 - f5, f4 - f6, 0.0D).tex(f1, f2).normal(0.0F, 1.0F, 0.0F).endVertex();
p_77026_1_.getBuffer().pos(0.0F - f5, f4 - f6, 0.0D).tex(f, f2).normal(0.0F, 1.0F, 0.0F).endVertex();
p_77026_1_.draw();
tess.getBuffer().begin(GL11.GL_QUADS, ClientProxy.POSITION_TEX_LMAP_NORMAL);
tess.getBuffer().pos(0.0F - f5, 0.0F - f6, 0.0D).tex(f, f3).lightmap(240, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
tess.getBuffer().pos(f4 - f5, 0.0F - f6, 0.0D).tex(f1, f3).lightmap(240, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
tess.getBuffer().pos(f4 - f5, f4 - f6, 0.0D).tex(f1, f2).lightmap(240, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
tess.getBuffer().pos(0.0F - f5, f4 - f6, 0.0D).tex(f, f2).lightmap(240, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
tess.draw();
}
@@ -1,32 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Aug 27, 2015, 10:02:12 PM (GMT)]
*/
package vazkii.botania.client.render.entity;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraft.item.ItemStack;
import vazkii.botania.common.entity.EntityThornChakram;
import vazkii.botania.common.item.ModItems;
// Basically a bit of an extension of RenderSnowball
public class RenderThornChakram extends RenderSnowball<EntityThornChakram> {
public RenderThornChakram(RenderManager renderManager) {
super(renderManager, ModItems.thornChakram, Minecraft.getMinecraft().getRenderItem());
}
@Override
public ItemStack getStackToRender(EntityThornChakram entityIn) {
return new ItemStack(ModItems.thornChakram, 1, entityIn.isFire() ? 1 : 0);
}
}
@@ -25,6 +25,7 @@ import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.api.state.enums.AlfPortalState;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.core.handler.MiscellaneousIcons;
import vazkii.botania.client.core.proxy.ClientProxy;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.tile.TileAlfPortal;
@@ -78,12 +79,11 @@ public class RenderTileAlfPortal extends TileEntitySpecialRenderer<TileAlfPortal
public void renderIcon(int par1, int par2, TextureAtlasSprite par3Icon, int par4, int par5, int brightness) {
Tessellator tessellator = Tessellator.getInstance();
tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
//tessellator.getBuffer().setBrightness(brightness);
tessellator.getBuffer().pos(par1 + 0, par2 + par5, 0).tex(par3Icon.getMinU(), par3Icon.getMaxV()).endVertex();
tessellator.getBuffer().pos(par1 + par4, par2 + par5, 0).tex(par3Icon.getMaxU(), par3Icon.getMaxV()).endVertex();
tessellator.getBuffer().pos(par1 + par4, par2 + 0, 0).tex(par3Icon.getMaxU(), par3Icon.getMinV()).endVertex();
tessellator.getBuffer().pos(par1 + 0, par2 + 0, 0).tex(par3Icon.getMinU(), par3Icon.getMinV()).endVertex();
tessellator.getBuffer().begin(GL11.GL_QUADS, ClientProxy.POSITION_TEX_LMAP);
tessellator.getBuffer().pos(par1 + 0, par2 + par5, 0).tex(par3Icon.getMinU(), par3Icon.getMaxV()).lightmap(brightness, brightness).endVertex();
tessellator.getBuffer().pos(par1 + par4, par2 + par5, 0).tex(par3Icon.getMaxU(), par3Icon.getMaxV()).lightmap(brightness, brightness).endVertex();
tessellator.getBuffer().pos(par1 + par4, par2 + 0, 0).tex(par3Icon.getMaxU(), par3Icon.getMinV()).lightmap(brightness, brightness).endVertex();
tessellator.getBuffer().pos(par1 + 0, par2 + 0, 0).tex(par3Icon.getMinU(), par3Icon.getMinV()).lightmap(brightness, brightness).endVertex();
tessellator.draw();
}
@@ -56,7 +56,7 @@ public class RenderTileAltar extends TileEntitySpecialRenderer<TileAltar> {
if(water) {
int petals = 0;
for(int i = 0; i < altar.getSizeInventory(); i++)
if(altar.getItemHandler().getStackInSlot(i) != null)
if(!altar.getItemHandler().getStackInSlot(i).isEmpty())
petals++;
else break;
@@ -10,7 +10,7 @@
*/
package vazkii.botania.client.render.tile;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.lwjgl.opengl.GL11;
@@ -41,7 +41,7 @@ public class RenderTileAvatar extends TileEntitySpecialRenderer<TileAvatar> {
private static final ModelAvatar model = new ModelAvatar();
@Override
public void renderTileEntityAt(@Nonnull TileAvatar avatar, double d0, double d1, double d2, float pticks, int digProgress) {
public void renderTileEntityAt(@Nullable TileAvatar avatar, double d0, double d1, double d2, float pticks, int digProgress) {
if (avatar != null)
if (!avatar.getWorld().isBlockLoaded(avatar.getPos(), false)
|| avatar.getWorld().getBlockState(avatar.getPos()).getBlock() != ModBlocks.avatar)
@@ -71,7 +71,7 @@ public class RenderTileAvatar extends TileEntitySpecialRenderer<TileAvatar> {
}
ItemStack stack = avatar.getItemHandler().getStackInSlot(0);
if(stack != null) {
if(!stack.isEmpty()) {
GlStateManager.pushMatrix();
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
float s = 0.6F;
@@ -10,7 +10,7 @@
*/
package vazkii.botania.client.render.tile;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
@@ -31,7 +31,7 @@ public class RenderTileBellows extends TileEntitySpecialRenderer<TileBellows> {
private static final ModelBellows model = new ModelBellows();
@Override
public void renderTileEntityAt(@Nonnull TileBellows bellows, double d0, double d1, double d2, float f, int digProgress) {
public void renderTileEntityAt(@Nullable TileBellows bellows, double d0, double d1, double d2, float f, int digProgress) {
if (bellows != null)
if (!bellows.getWorld().isBlockLoaded(bellows.getPos(), false)
|| bellows.getWorld().getBlockState(bellows.getPos()).getBlock() != ModBlocks.bellows)
@@ -11,6 +11,7 @@
package vazkii.botania.client.render.tile;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
@@ -31,7 +32,7 @@ public class RenderTileBrewery extends TileEntitySpecialRenderer<TileBrewery> {
public TileBrewery brewery;
@Override
public void renderTileEntityAt(@Nonnull TileBrewery brewery, double d0, double d1, double d2, float f, int digProgress) {
public void renderTileEntityAt(@Nullable TileBrewery brewery, double d0, double d1, double d2, float f, int digProgress) {
this.brewery = brewery;
GlStateManager.pushMatrix();
GlStateManager.enableRescaleNormal();
@@ -50,7 +51,7 @@ public class RenderTileBrewery extends TileEntitySpecialRenderer<TileBrewery> {
}
public void renderItemStack(ItemStack stack) {
if(stack != null) {
if(!stack.isEmpty()) {
Minecraft mc = Minecraft.getMinecraft();
GlStateManager.pushMatrix();
mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
@@ -51,7 +51,7 @@ public class RenderTileCorporeaCrystalCube extends TileEntitySpecialRenderer<Til
@Override
public void renderTileEntityAt(@Nonnull TileCorporeaCrystalCube cube, double d0, double d1, double d2, float f, int digProgress) {
ItemStack stack = null;
ItemStack stack = ItemStack.EMPTY;
if (cube != null) {
if(entity == null)
entity = new EntityItem(cube.getWorld(), cube.getPos().getX(), cube.getPos().getY(), cube.getPos().getZ(), new ItemStack(Blocks.STONE));
@@ -85,7 +85,7 @@ public class RenderTileCorporeaCrystalCube extends TileEntitySpecialRenderer<Til
GlStateManager.translate(0.5F, 1.5F, 0.5F);
GlStateManager.scale(1F, -1F, -1F);
GlStateManager.translate(0F, (float) Math.sin(worldTicks / 20.0 * 1.55) * 0.025F, 0F);
if(stack != null) {
if(!stack.isEmpty()) {
GlStateManager.pushMatrix();
float s = stack.getItem() instanceof ItemBlock ? 0.7F : 0.5F;
GlStateManager.translate(0F, 0.8F, 0F);
@@ -97,7 +97,7 @@ public class RenderTileCorporeaCrystalCube extends TileEntitySpecialRenderer<Til
GlStateManager.color(1F, 1F, 1F);
if(stack != null) {
if(!stack.isEmpty()) {
int count = cube.getItemCount();
String countStr = "" + count;
int color = 0xFFFFFF;
@@ -170,7 +170,7 @@ public class RenderTileCorporeaCrystalCube extends TileEntitySpecialRenderer<Til
BlockPos pos = te.getPos();
IBlockAccess world = MinecraftForgeClient.getRegionRenderCache(te.getWorld(), pos);
IBlockState state = world.getBlockState(pos);
if(state.getPropertyNames().contains(Properties.StaticProperty))
if(state.getPropertyKeys().contains(Properties.StaticProperty))
{
state = state.withProperty(Properties.StaticProperty, false);
}
@@ -10,7 +10,7 @@
*/
package vazkii.botania.client.render.tile;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelEnderCrystal;
@@ -28,7 +28,7 @@ public class RenderTileCorporeaIndex extends TileEntitySpecialRenderer<TileCorpo
public static boolean move = true;
@Override
public void renderTileEntityAt(@Nonnull TileCorporeaIndex index, double x, double y, double z, float partticks, int digProgress) {
public void renderTileEntityAt(@Nullable TileCorporeaIndex index, double x, double y, double z, float partticks, int digProgress) {
move = index != null;
GlStateManager.pushMatrix();
@@ -27,6 +27,7 @@ import net.minecraft.entity.item.EntityItem;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.core.handler.MiscellaneousIcons;
import vazkii.botania.client.core.helper.ShaderHelper;
import vazkii.botania.client.core.proxy.ClientProxy;
import vazkii.botania.common.block.tile.TileEnchanter;
import vazkii.botania.common.core.handler.MethodHandles;
@@ -45,7 +46,7 @@ public class RenderTileEnchanter extends TileEntitySpecialRenderer<TileEnchanter
else if(enchanter.stage == TileEnchanter.State.DO_ENCHANT)
alphaMod = 1F;
if(enchanter.itemToEnchant != null) {
if(!enchanter.itemToEnchant.isEmpty()) {
if(item == null)
item = new EntityItem(enchanter.getWorld(), enchanter.getPos().getX(), enchanter.getPos().getY() + 1, enchanter.getPos().getZ(), enchanter.itemToEnchant);
@@ -111,12 +112,11 @@ public class RenderTileEnchanter extends TileEntitySpecialRenderer<TileEnchanter
private void renderIcon(int par1, int par2, TextureAtlasSprite par3Icon, int par4, int par5, int brightness) {
Tessellator tessellator = Tessellator.getInstance();
tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
//tessellator.getBuffer().setBrightness(brightness);
tessellator.getBuffer().pos(par1 + 0, par2 + par5, 0).tex(par3Icon.getMinU(), par3Icon.getMaxV()).endVertex();
tessellator.getBuffer().pos(par1 + par4, par2 + par5, 0).tex(par3Icon.getMaxU(), par3Icon.getMaxV()).endVertex();
tessellator.getBuffer().pos(par1 + par4, par2 + 0, 0).tex(par3Icon.getMaxU(), par3Icon.getMinV()).endVertex();
tessellator.getBuffer().pos(par1 + 0, par2 + 0, 0).tex(par3Icon.getMinU(), par3Icon.getMinV()).endVertex();
tessellator.getBuffer().begin(GL11.GL_QUADS, ClientProxy.POSITION_TEX_LMAP);
tessellator.getBuffer().pos(par1 + 0, par2 + par5, 0).tex(par3Icon.getMinU(), par3Icon.getMaxV()).lightmap(brightness, brightness).endVertex();
tessellator.getBuffer().pos(par1 + par4, par2 + par5, 0).tex(par3Icon.getMaxU(), par3Icon.getMaxV()).lightmap(brightness, brightness).endVertex();
tessellator.getBuffer().pos(par1 + par4, par2 + 0, 0).tex(par3Icon.getMaxU(), par3Icon.getMinV()).lightmap(brightness, brightness).endVertex();
tessellator.getBuffer().pos(par1 + 0, par2 + 0, 0).tex(par3Icon.getMinU(), par3Icon.getMinV()).lightmap(brightness, brightness).endVertex();
tessellator.draw();
}
@@ -23,8 +23,8 @@ import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.boss.EntityWither;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.entity.monster.EntityWitherSkeleton;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.monster.SkeletonType;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntitySkull;
import net.minecraft.util.EnumFacing;
@@ -61,11 +61,11 @@ public class RenderTileGaiaHead extends TileEntitySkullRenderer {
if(view instanceof EntityPlayer) {
skullType = 3;
profile = ((EntityPlayer) mc.getRenderViewEntity()).getGameProfile();
} else if (view instanceof EntitySkeleton) {
} else if (view instanceof EntitySkeleton)
skullType = 0;
if (((EntitySkeleton) view).func_189771_df() == SkeletonType.WITHER)
skullType = 1;
} else if(view instanceof EntityWither)
else if(view instanceof EntityWitherSkeleton)
skullType = 1;
else if(view instanceof EntityWither)
skullType = 1;
else if(view instanceof EntityZombie)
skullType = 2;
@@ -12,7 +12,7 @@ package vazkii.botania.client.render.tile;
import java.util.Random;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.lwjgl.opengl.GL11;
@@ -32,7 +32,7 @@ public class RenderTileHourglass extends TileEntitySpecialRenderer<TileHourglass
final ModelHourglass model = new ModelHourglass();
@Override
public void renderTileEntityAt(@Nonnull TileHourglass hourglass, double d0, double d1, double d2, float ticks, int digProgress) {
public void renderTileEntityAt(@Nullable TileHourglass hourglass, double d0, double d1, double d2, float ticks, int digProgress) {
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
@@ -48,11 +48,11 @@ public class RenderTileHourglass extends TileEntitySpecialRenderer<TileHourglass
float x = 0.5F + (float) Math.cos(time * 0.05F) * 0.025F;
float y = 0.55F + (float) (Math.sin(time * 0.04F) + 1F) * 0.05F;
float z = 0.5F + (float) Math.sin(time * 0.05F) * 0.025F;
ItemStack stack = hasWorld ? hourglass.getItemHandler().getStackInSlot(0) : null;
ItemStack stack = hasWorld ? hourglass.getItemHandler().getStackInSlot(0) : ItemStack.EMPTY;
float activeFraction = stack == null ? 0 : hourglass.lastFraction + (hourglass.timeFraction - hourglass.lastFraction) * ticks;
float fract1 = stack == null ? 0 : activeFraction;
float fract2 = stack == null ? 0 : 1F - activeFraction;
float activeFraction = stack.isEmpty() ? 0 : hourglass.lastFraction + (hourglass.timeFraction - hourglass.lastFraction) * ticks;
float fract1 = stack.isEmpty() ? 0 : activeFraction;
float fract2 = stack.isEmpty() ? 0 : 1F - activeFraction;
GlStateManager.translate(x, y, z);
float rot = hasWorld && hourglass.flip ? 180F : 1F;
@@ -39,7 +39,7 @@ public class RenderTileIncensePlate extends TileEntitySpecialRenderer<TileIncens
return;
ItemStack stack = plate.getItemHandler().getStackInSlot(0);
if(stack == null)
if(stack.isEmpty())
return;
EnumFacing facing = plate.getWorld().getBlockState(plate.getPos()).getValue(BotaniaStateProps.CARDINALS);
@@ -29,6 +29,7 @@ import vazkii.botania.api.state.enums.LuminizerVariant;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.core.handler.MiscellaneousIcons;
import vazkii.botania.client.core.helper.ShaderHelper;
import vazkii.botania.client.core.proxy.ClientProxy;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.tile.TileLightRelay;
@@ -77,7 +78,7 @@ public class RenderTileLightRelay extends TileEntitySpecialRenderer<TileLightRel
mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
ShaderHelper.useShader(ShaderHelper.halo);
func_77026_a(tessellator, iicon);
renderIcon(tessellator, iicon);
ShaderHelper.releaseShader();
GlStateManager.popMatrix();
@@ -87,11 +88,11 @@ public class RenderTileLightRelay extends TileEntitySpecialRenderer<TileLightRel
GlStateManager.popMatrix();
}
private void func_77026_a(Tessellator p_77026_1_, TextureAtlasSprite p_77026_2_) {
float f = p_77026_2_.getMinU();
float f1 = p_77026_2_.getMaxU();
float f2 = p_77026_2_.getMinV();
float f3 = p_77026_2_.getMaxV();
private void renderIcon(Tessellator tess, TextureAtlasSprite icon) {
float f = icon.getMinU();
float f1 = icon.getMaxU();
float f2 = icon.getMinV();
float f3 = icon.getMaxV();
float size = f1 - f;
float pad = size / 8F;
f += pad;
@@ -103,13 +104,12 @@ public class RenderTileLightRelay extends TileEntitySpecialRenderer<TileLightRel
float f5 = 0.5F;
float f6 = 0.25F;
p_77026_1_.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_NORMAL);
//p_77026_1_.getBuffer().setBrightness(240);
p_77026_1_.getBuffer().pos(0.0F - f5, 0.0F - f6, 0.0D).tex(f, f3).normal(0, 1, 0).endVertex();
p_77026_1_.getBuffer().pos(f4 - f5, 0.0F - f6, 0.0D).tex(f1, f3).normal(0, 1, 0).endVertex();
p_77026_1_.getBuffer().pos(f4 - f5, f4 - f6, 0.0D).tex(f1, f2).normal(0, 1, 0).endVertex();
p_77026_1_.getBuffer().pos(0.0F - f5, f4 - f6, 0.0D).tex(f, f2).normal(0, 1, 0).endVertex();
p_77026_1_.draw();
tess.getBuffer().begin(GL11.GL_QUADS, ClientProxy.POSITION_TEX_LMAP_NORMAL);
tess.getBuffer().pos(0.0F - f5, 0.0F - f6, 0.0D).tex(f, f3).lightmap(240, 240).normal(0, 1, 0).endVertex();
tess.getBuffer().pos(f4 - f5, 0.0F - f6, 0.0D).tex(f1, f3).lightmap(240, 240).normal(0, 1, 0).endVertex();
tess.getBuffer().pos(f4 - f5, f4 - f6, 0.0D).tex(f1, f2).lightmap(240, 240).normal(0, 1, 0).endVertex();
tess.getBuffer().pos(0.0F - f5, f4 - f6, 0.0D).tex(f, f2).lightmap(240, 240).normal(0, 1, 0).endVertex();
tess.draw();
}
@@ -33,6 +33,7 @@ import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.core.handler.MiscellaneousIcons;
import vazkii.botania.client.core.handler.MultiblockRenderHandler;
import vazkii.botania.client.core.helper.ShaderHelper;
import vazkii.botania.client.core.proxy.ClientProxy;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.tile.mana.TilePool;
@@ -146,12 +147,11 @@ public class RenderTilePool extends TileEntitySpecialRenderer<TilePool> {
public void renderIcon(int par1, int par2, TextureAtlasSprite par3Icon, int par4, int par5, int brightness) {
Tessellator tessellator = Tessellator.getInstance();
tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
//tessellator.getBuffer().setBrightness(brightness);
tessellator.getBuffer().pos(par1 + 0, par2 + par5, 0).tex(par3Icon.getMinU(), par3Icon.getMaxV()).endVertex();
tessellator.getBuffer().pos(par1 + par4, par2 + par5, 0).tex(par3Icon.getMaxU(), par3Icon.getMaxV()).endVertex();
tessellator.getBuffer().pos(par1 + par4, par2 + 0, 0).tex(par3Icon.getMaxU(), par3Icon.getMinV()).endVertex();
tessellator.getBuffer().pos(par1 + 0, par2 + 0, 0).tex(par3Icon.getMinU(), par3Icon.getMinV()).endVertex();
tessellator.getBuffer().begin(GL11.GL_QUADS, ClientProxy.POSITION_TEX_LMAP);
tessellator.getBuffer().pos(par1 + 0, par2 + par5, 0).tex(par3Icon.getMinU(), par3Icon.getMaxV()).lightmap(brightness, brightness).endVertex();
tessellator.getBuffer().pos(par1 + par4, par2 + par5, 0).tex(par3Icon.getMaxU(), par3Icon.getMaxV()).lightmap(brightness, brightness).endVertex();
tessellator.getBuffer().pos(par1 + par4, par2 + 0, 0).tex(par3Icon.getMaxU(), par3Icon.getMinV()).lightmap(brightness, brightness).endVertex();
tessellator.getBuffer().pos(par1 + 0, par2 + 0, 0).tex(par3Icon.getMinU(), par3Icon.getMinV()).lightmap(brightness, brightness).endVertex();
tessellator.draw();
}
@@ -34,7 +34,7 @@ public class RenderTilePrism extends TileEntitySpecialRenderer<TilePrism> {
ItemStack stack = prism.getItemHandler().getStackInSlot(0);
if(stack != null) {
if(!stack.isEmpty()) {
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
if(stack.getItem() instanceof ILens) {
GlStateManager.pushMatrix();
@@ -35,7 +35,7 @@ public class RenderTileRuneAltar extends TileEntitySpecialRenderer<TileRuneAltar
int items = 0;
for(int i = 0; i < altar.getSizeInventory(); i++)
if(altar.getItemHandler().getStackInSlot(i) == null)
if(altar.getItemHandler().getStackInSlot(i).isEmpty())
break;
else items++;
float[] angles = new float[altar.getSizeInventory()];
@@ -57,7 +57,7 @@ public class RenderTileRuneAltar extends TileEntitySpecialRenderer<TileRuneAltar
GlStateManager.translate(0D, 0.075 * Math.sin((time + i * 10) / 5D), 0F);
ItemStack stack = altar.getItemHandler().getStackInSlot(i);
Minecraft mc = Minecraft.getMinecraft();
if(stack != null) {
if(!stack.isEmpty()) {
mc.getRenderItem().renderItem(stack, ItemCameraTransforms.TransformType.GROUND);
}
GlStateManager.popMatrix();
@@ -30,7 +30,7 @@ public class RenderTileSparkChanger extends TileEntitySpecialRenderer<TileSparkC
GlStateManager.translate(0.8F, 0.2F, -0.22F);
GlStateManager.color(1F, 1F, 1F, 1F);
ItemStack stack = tileentity.getItemHandler().getStackInSlot(0);
if(stack != null) {
if(!stack.isEmpty()) {
GlStateManager.pushMatrix();
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
float s = 0.6F;
Loaded 100 of 2404 files, more files were not shown because too many files have changed in this diff. Show more