1.7.10 - 1.3.1.5
1.12.2 - alpha
No files matched your search
@@ -0,0 +1,20 @@
|
||||
# These are some examples of commonly ignored file patterns.
|
||||
# You should customize this list as applicable to your project.
|
||||
# Learn more about .gitignore:
|
||||
# https://www.atlassian.com/git/tutorials/saving-changes/gitignore
|
||||
|
||||
# eclipse
|
||||
bin
|
||||
*.launch
|
||||
.settings
|
||||
.metadata
|
||||
.classpath
|
||||
.project
|
||||
|
||||
# gradle
|
||||
build
|
||||
.gradle
|
||||
|
||||
# other
|
||||
eclipse
|
||||
run
|
||||
@@ -1,28 +0,0 @@
|
||||
This is Forge Mod Loader.
|
||||
|
||||
You can find the source code at all times at https://github.com/MinecraftForge/FML
|
||||
|
||||
This minecraft mod is a clean open source implementation of a mod loader for minecraft servers
|
||||
and minecraft clients.
|
||||
|
||||
The code is authored by cpw.
|
||||
|
||||
It began by partially implementing an API defined by the client side ModLoader, authored by Risugami.
|
||||
http://www.minecraftforum.net/topic/75440-
|
||||
This support has been dropped as of Minecraft release 1.7, as Risugami no longer maintains ModLoader.
|
||||
|
||||
It also contains suggestions and hints and generous helpings of code from LexManos, author of MinecraftForge.
|
||||
http://www.minecraftforge.net/
|
||||
|
||||
Additionally, it contains an implementation of topological sort based on that
|
||||
published at http://keithschwarz.com/interesting/code/?dir=topological-sort
|
||||
|
||||
It also contains code from the Maven project for performing versioned dependency
|
||||
resolution. http://maven.apache.org/
|
||||
|
||||
It also contains a partial repackaging of the javaxdelta library from http://sourceforge.net/projects/javaxdelta/
|
||||
with credit to it's authors.
|
||||
|
||||
Forge Mod Loader downloads components from the Minecraft Coder Pack
|
||||
(http://mcp.ocean-labs.de/index.php/Main_Page) with kind permission from the MCP team.
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
Minecraft Forge: Credits/Thank You
|
||||
|
||||
Forge is a set of tools and modifications to the Minecraft base game code to assist
|
||||
mod developers in creating new and exciting content. It has been in development for
|
||||
several years now, but I would like to take this time thank a few people who have
|
||||
helped it along it's way.
|
||||
|
||||
First, the people who originally created the Forge projects way back in Minecraft
|
||||
alpha. Eloraam of RedPower, and SpaceToad of Buildcraft, without their acceptiance
|
||||
of me taking over the project, who knows what Minecraft modding would be today.
|
||||
|
||||
Secondly, someone who has worked with me, and developed some of the core features
|
||||
that allow modding to he as functional, and as simple as it is, cpw. For developing
|
||||
FML, which stabelized the client and server modding ecosystem. As well as the base
|
||||
loading system that allows us to modify Minecraft's code as elegently as possible.
|
||||
|
||||
Mezz, who has stepped up as the issue and pull request manager. Helping to keep me
|
||||
sane as well as guiding the community into creating better additions to Forge.
|
||||
|
||||
Searge, Bspks, Fesh0r, ProfMobious, and all the rest over on the MCP team {of which
|
||||
I am a part}. For creating some of the core tools needed to make Minecraft modding
|
||||
both possible, and as stable as can be.
|
||||
On that note, here is some specific information of the MCP data we use:
|
||||
* Minecraft Coder Pack (MCP) *
|
||||
Forge Mod Loader and Minecraft Forge have permission to distribute and automatically
|
||||
download components of MCP and distribute MCP data files. This permission is not
|
||||
transitive and others wishing to redistribute the Minecraft Forge source independently
|
||||
should seek permission of MCP or remove the MCP data files and request their users
|
||||
to download MCP separately.
|
||||
|
||||
And lastly, the countless community members who have spent time submitting bug reports,
|
||||
pull requests, and just helping out the community in general. Thank you.
|
||||
|
||||
--LexManos
|
||||
|
||||
=========================================================================
|
||||
|
||||
This is Forge Mod Loader.
|
||||
|
||||
You can find the source code at all times at https://github.com/MinecraftForge/MinecraftForge/tree/1.12.x/src/main/java/net/minecraftforge/fml
|
||||
|
||||
This minecraft mod is a clean open source implementation of a mod loader for minecraft servers
|
||||
and minecraft clients.
|
||||
|
||||
The code is authored by cpw.
|
||||
|
||||
It began by partially implementing an API defined by the client side ModLoader, authored by Risugami.
|
||||
http://www.minecraftforum.net/topic/75440-
|
||||
This support has been dropped as of Minecraft release 1.7, as Risugami no longer maintains ModLoader.
|
||||
|
||||
It also contains suggestions and hints and generous helpings of code from LexManos, author of MinecraftForge.
|
||||
http://www.minecraftforge.net/
|
||||
|
||||
Additionally, it contains an implementation of topological sort based on that
|
||||
published at http://keithschwarz.com/interesting/code/?dir=topological-sort
|
||||
|
||||
It also contains code from the Maven project for performing versioned dependency
|
||||
resolution. http://maven.apache.org/
|
||||
|
||||
It also contains a partial repackaging of the javaxdelta library from http://sourceforge.net/projects/javaxdelta/
|
||||
with credit to it's authors.
|
||||
|
||||
Forge Mod Loader downloads components from the Minecraft Coder Pack
|
||||
(http://mcp.ocean-labs.de/index.php/Main_Page) with kind permission from the MCP team.
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
Minecraft Forge is licensed under the terms of the LGPL 2.1 found
|
||||
here http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt and copied
|
||||
below.
|
||||
Unless noted below, Minecraft Forge, Forge Mod Loader, and all
|
||||
parts herein are licensed under the terms of the LGPL 2.1 found
|
||||
here http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt and
|
||||
copied below.
|
||||
|
||||
Homepage: http://MinecraftForge.net/
|
||||
http://github.com/MinecraftForge/MinecraftForge
|
||||
|
||||
|
||||
A note on authorship:
|
||||
All source artifacts are property of their original author, with
|
||||
@@ -23,6 +28,44 @@ Java mechanics for referencing libraries are specifically not bound
|
||||
by Forge's license for the Mod code.
|
||||
|
||||
|
||||
=== MCP Data ===
|
||||
This software includes data from the Minecraft Coder Pack (MCP), with kind permission
|
||||
from them. The license to MCP data is not transitive - distribution of this data by
|
||||
third parties requires independent licensing from the MCP team. This data is not
|
||||
redistributable without permission from the MCP team.
|
||||
|
||||
=== Sharing ===
|
||||
I grant permission for some parts of FML to be redistributed outside the terms of the LGPL, for the benefit of
|
||||
the minecraft modding community. All contributions to these parts should be licensed under the same additional grant.
|
||||
|
||||
-- Runtime patcher --
|
||||
License is granted to redistribute the runtime patcher code (src/main/java/net/minecraftforge/fml/common/patcher
|
||||
and subdirectories) under any alternative open source license as classified by the OSI (http://opensource.org/licenses)
|
||||
|
||||
-- ASM transformers --
|
||||
License is granted to redistribute the ASM transformer code (src/main/java/net/minecraftforge/common/asm/ and subdirectories)
|
||||
under any alternative open source license as classified by the OSI (http://opensource.org/licenses)
|
||||
|
||||
=========================================================================
|
||||
This software includes portions from the Apache Maven project at
|
||||
http://maven.apache.org/ specifically the ComparableVersion.java code. It is
|
||||
included based on guidelines at
|
||||
http://www.softwarefreedom.org/resources/2007/gpl-non-gpl-collaboration.html
|
||||
with notices intact. The only change is a non-functional change of package name.
|
||||
|
||||
This software contains a partial repackaging of javaxdelta, a BSD licensed program for generating
|
||||
binary differences and applying them, sourced from the subversion at http://sourceforge.net/projects/javaxdelta/
|
||||
authored by genman, heikok, pivot.
|
||||
The only changes are to replace some Trove collection types with standard Java collections, and repackaged.
|
||||
|
||||
This software contains potions of Paulscodee IBXM library, a BSD liceensed library for
|
||||
loading and playing IBXM formated auto. No modifications havee beeen made. The associated
|
||||
licenses can be found along side this one, or at
|
||||
https://github.com/MinecraftForge/MinecraftForge/blob/1.12.x/LICENSE-Paulscode%20IBXM%20Library.txt
|
||||
https://github.com/MinecraftForge/MinecraftForge/blob/1.12.x/LICENSE-Paulscode%20SoundSystem%20CodecIBXM.txt
|
||||
=========================================================================
|
||||
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
* Eloraam *
|
||||
|
||||
* FlowerChild *
|
||||
|
||||
* Hawkye *
|
||||
|
||||
* MALfunction84 *
|
||||
|
||||
Submitted the sleep handler code for his mod (Somnia) and others to use.
|
||||
|
||||
* Scokeev9 *
|
||||
|
||||
Gave permission for ScotTools API to be integrated into MCF, and also supported the Forge by converting his mods to use it.
|
||||
|
||||
ScotTools Background: ScotTools was an API that enabled modders to add blocks to harvesting levels (and many other ease-of-use features to create new tools), and the first tool API that used block material for block breaking efficiency which allowed blocks from mods that didn't use ScotTools API to break with the correct speed.
|
||||
|
||||
* SpaceToad *
|
||||
|
||||
* LexManos *
|
||||
|
||||
* cpw *
|
||||
|
||||
* Minecraft Coder Pack (MCP) *
|
||||
Forge Mod Loader and Minecraft Forge have permission to distribute and automatically download components of MCP and distribute MCP data files.
|
||||
This permission is not transitive and others wishing to redistribute the Minecraft Forge source independently should seek permission of MCP or
|
||||
remove the MCP data files and request their users to download MCP separately.
|
||||
@@ -21,7 +21,7 @@ compileJava {
|
||||
}
|
||||
|
||||
minecraft {
|
||||
version = "1.12.2-14.23.4.2705"
|
||||
version = "1.12.2-14.23.5.2768"
|
||||
runDir = "run"
|
||||
|
||||
// the mappings can be changed at any time, and must be in the following format.
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
Changelog:
|
||||
Build 2768:
|
||||
LexManos: Bump version number for RB.
|
||||
|
||||
Build 2767:
|
||||
LexManos:
|
||||
Change biome spawn list entries to use factory method where possible
|
||||
(#5075)
|
||||
LexManos: Prevent some texture loading errors from crashing the game (#5121)
|
||||
LexManos: Patch PotionHelper to use registry delegates (#5142)
|
||||
LexManos: Add a notification event for handling game rule changes (#5152)
|
||||
|
||||
Build 2766:
|
||||
LexManos:
|
||||
Change universal bucket support to use fluid names instead of instances
|
||||
(#5031)
|
||||
|
||||
Build 2765:
|
||||
LexManos: Fix NPE on clientside entities constructed with null world (#5170)
|
||||
|
||||
Build 2764:
|
||||
tterrag: Fix patches from #5160 running on the client and causing stutter
|
||||
|
||||
Build 2763:
|
||||
LexManos:
|
||||
Class transformer optimizations (#5159)
|
||||
* Filter packages for deobf transformation
|
||||
* Only serialize transformed class with TerminalTransformer if bytecode
|
||||
changed
|
||||
|
||||
Build 2762:
|
||||
github: Update github stale so issues can be Assigned
|
||||
|
||||
Build 2761:
|
||||
LexManos:
|
||||
Fix MC-136995 - Chunk loading and unloading issue with entities placed
|
||||
in exact positions. (#5160)
|
||||
Scatter gun patches to improve entity tracking and position tracking.
|
||||
Provided by Aikar through the Paper project, this commit of patches
|
||||
combines the following patches:
|
||||
|
||||
https://github.com/PaperMC/Paper/blob/fd1bd5223a461b6d98280bb8f2d67280a30dd24a/Spigot-Server-Patches/0306-Mark-chunk-dirty-anytime-entities-change-to-guarante.patch
|
||||
|
||||
https://github.com/PaperMC/Paper/blob/fd1bd5223a461b6d98280bb8f2d67280a30dd24a/Spigot-Server-Patches/0315-Always-process-chunk-registration-after-moving.patch
|
||||
|
||||
https://github.com/PaperMC/Paper/blob/fd1bd5223a461b6d98280bb8f2d67280a30dd24a/Spigot-Server-Patches/0335-Ensure-chunks-are-always-loaded-on-hard-position-set.patch
|
||||
|
||||
https://github.com/PaperMC/Paper/blob/fd1bd5223a461b6d98280bb8f2d67280a30dd24a/Spigot-Server-Patches/0378-Sync-Player-Position-to-Vehicles.patch
|
||||
|
||||
Build 2760:
|
||||
LexManos: Fix --mods and --modListFile arguments not making it past LaunchWrapper.
|
||||
|
||||
Build 2759:
|
||||
LexManos: Remove BlamingTransformer (#5115)
|
||||
|
||||
@@ -15,7 +15,7 @@ import pulxes.ab.common.core.proxy.CommonProxy;
|
||||
@Mod(modid = AdvancedBotany.MODID, name="Advanced Botany", version = AdvancedBotany.VERSION, dependencies = "required-after:botania", guiFactory = "pulxes.ab.client.core.proxy.GuiFactory", acceptedMinecraftVersions = "[1.12.2]")
|
||||
public class AdvancedBotany {
|
||||
|
||||
public static final String MODID = "advancedbotany";
|
||||
public static final String MODID = "advanced_botany";
|
||||
public static final String VERSION = "2.0.0";
|
||||
|
||||
public static final CreativeTabs tabAB = new AdvancedBotanyTab();
|
||||
|
||||
@@ -1,9 +1,30 @@
|
||||
package pulxes.ab.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
import pulxes.ab.api.recipe.RecipeAncientAlphirine;
|
||||
import pulxes.ab.api.recipe.RecipeNidavellirForge;
|
||||
|
||||
public class AdvancedBotanyAPI {
|
||||
|
||||
public static List<RecipeAncientAlphirine> alphirineRecipes = new ArrayList<RecipeAncientAlphirine>();
|
||||
public static List<RecipeNidavellirForge> forgeRecipes = new ArrayList<RecipeNidavellirForge>();
|
||||
|
||||
public static final Item.ToolMaterial MITHRILL_TOOL_MATERIAL = EnumHelper.addToolMaterial("MITHRIL", 7, -1, 8.0F, 4.0F, 24);
|
||||
}
|
||||
|
||||
public static RecipeAncientAlphirine registerAlphirineRecipe(ItemStack output, Object input, int chance) {
|
||||
RecipeAncientAlphirine recipe = new RecipeAncientAlphirine(output, input, chance);
|
||||
alphirineRecipes.add(recipe);
|
||||
return recipe;
|
||||
}
|
||||
|
||||
public static RecipeNidavellirForge registerForgeRecipe(ItemStack output, Object input1, Object input2, Object input3, int mana, int color) {
|
||||
RecipeNidavellirForge recipe = new RecipeNidavellirForge(output, mana, color, input1, input2, input3);
|
||||
forgeRecipes.add(recipe);
|
||||
return recipe;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package pulxes.ab.api;
|
||||
|
||||
public abstract class EffectRender {
|
||||
|
||||
public int tick;
|
||||
|
||||
public EffectRender(int tick) {
|
||||
this.tick = tick;
|
||||
}
|
||||
|
||||
public abstract void doEffect();
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package pulxes.ab.api.recipe;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class RecipeAncientAlphirine {
|
||||
|
||||
private ItemStack output;
|
||||
private Object input;
|
||||
private int chance;
|
||||
|
||||
public RecipeAncientAlphirine(ItemStack output, Object input, int chance) {
|
||||
this.output = output;
|
||||
if(input instanceof String || input instanceof ItemStack)
|
||||
this.input = input;
|
||||
else
|
||||
throw new IllegalArgumentException("Invalid input");
|
||||
this.input = input;
|
||||
if(chance > 100)
|
||||
chance = 100;
|
||||
else if(chance <= 0)
|
||||
chance = 1;
|
||||
this.chance = chance;
|
||||
}
|
||||
|
||||
public boolean matches(ItemStack stack) {
|
||||
if(stack.isEmpty())
|
||||
return false;
|
||||
if(input instanceof String) {
|
||||
boolean found = false;
|
||||
for(ItemStack oreStack : OreDictionary.getOres((String)input, false)) {
|
||||
if(OreDictionary.itemMatches(oreStack, stack, false)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return found;
|
||||
} else if(input instanceof ItemStack) {
|
||||
ItemStack inputCopy = ((ItemStack)input).copy();
|
||||
if(inputCopy.getItemDamage() == 32767)
|
||||
inputCopy.setItemDamage(stack.getItemDamage());
|
||||
return stack.getItem() == inputCopy.getItem() && stack.getItemDamage() == inputCopy.getItemDamage();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public ItemStack getOutput() {
|
||||
return output;
|
||||
}
|
||||
|
||||
public Object getInput() {
|
||||
return input;
|
||||
}
|
||||
|
||||
public int getChance() {
|
||||
return chance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package pulxes.ab.api.recipe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import vazkii.botania.api.recipe.RecipePetals;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
|
||||
public class RecipeNidavellirForge extends RecipePetals {
|
||||
|
||||
private int color;
|
||||
private int mana;
|
||||
|
||||
public RecipeNidavellirForge(ItemStack output, int mana, int color, Object... inputs) {
|
||||
super(output, inputs);
|
||||
this.mana = mana;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public boolean matches(IItemHandler inv) {
|
||||
List<Object> inputsMissing = new ArrayList(getInputs());
|
||||
for(int i = 1; i < inv.getSlots(); i++) {
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
if(stack.isEmpty())
|
||||
break;
|
||||
int stackIndex = -1, oredictIndex = -1;
|
||||
for(int j = 0; j < inputsMissing.size(); j++) {
|
||||
Object input = inputsMissing.get(j);
|
||||
if(input instanceof String) {
|
||||
boolean found = false;
|
||||
for(ItemStack ostack : OreDictionary.getOres((String)input, false)) {
|
||||
if(OreDictionary.itemMatches(ostack, stack, false)) {
|
||||
oredictIndex = j;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found)
|
||||
break;
|
||||
} else if(input instanceof ItemStack && compareStacks((ItemStack)input, stack)) {
|
||||
stackIndex = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(stackIndex != -1)
|
||||
inputsMissing.remove(stackIndex);
|
||||
else if(oredictIndex != -1)
|
||||
inputsMissing.remove(oredictIndex);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
return inputsMissing.isEmpty();
|
||||
}
|
||||
|
||||
private boolean compareStacks(ItemStack recipe, ItemStack supplied) {
|
||||
return (recipe.getItem() == supplied.getItem() && recipe.getItemDamage() == supplied.getItemDamage() && ItemNBTHelper.matchTag(recipe.getTagCompound(), supplied.getTagCompound()));
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
public int getManaUsage() {
|
||||
return this.mana;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package pulxes.ab.client.core.handler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import pulxes.ab.api.EffectRender;
|
||||
|
||||
public class ClientEffectHandler {
|
||||
|
||||
public static List<EffectRender> effectRendersList = new ArrayList<EffectRender>();
|
||||
|
||||
public static void addEffectRender(EffectRender effectRender) {
|
||||
effectRendersList.add(effectRender);
|
||||
}
|
||||
|
||||
public static void tick() {
|
||||
if(!effectRendersList.isEmpty())
|
||||
for(int i = 0; i < effectRendersList.size(); i++) {
|
||||
EffectRender effectRender = effectRendersList.get(i);
|
||||
if(effectRender.tick <= 0) {
|
||||
effectRendersList.remove(i);
|
||||
continue;
|
||||
}
|
||||
effectRender.doEffect();
|
||||
effectRender.tick--;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,11 @@ public class ClientTickHandler {
|
||||
public void clientTickEnd(TickEvent.ClientTickEvent event) {
|
||||
if(event.phase == TickEvent.Phase.END) {
|
||||
ClientSoundHandler.tick();
|
||||
ClientEffectHandler.tick();
|
||||
}
|
||||
}
|
||||
|
||||
public static void renderTooltip() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package pulxes.ab.client.core.handler;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.profiler.Profiler;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import pulxes.ab.AdvancedBotany;
|
||||
import pulxes.ab.common.item.equipment.ItemBlackHoleBox;
|
||||
import vazkii.botania.common.item.ItemCraftingHalo;
|
||||
|
||||
@EventBusSubscriber(value = {Side.CLIENT}, modid = AdvancedBotany.MODID)
|
||||
public class HUDHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onDrawScreenPost(RenderGameOverlayEvent.Post event) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Profiler profiler = mc.mcProfiler;
|
||||
ItemStack main = mc.player.getHeldItemMainhand();
|
||||
ItemStack offhand = mc.player.getHeldItemOffhand();
|
||||
if(event.getType() == RenderGameOverlayEvent.ElementType.ALL) {
|
||||
boolean hasCraftingHalo = (mc.player.getHeldItemMainhand().getItem() instanceof ItemCraftingHalo) || (mc.player.getHeldItemOffhand().getItem() instanceof ItemCraftingHalo);
|
||||
if(!hasCraftingHalo) {
|
||||
if(!main.isEmpty() && main.getItem() instanceof ItemBlackHoleBox) {
|
||||
profiler.startSection("blackHoleBox_main");
|
||||
ItemBlackHoleBox.renderHUD(event.getResolution(), mc.player, main);
|
||||
profiler.endSection();
|
||||
} else if(!offhand.isEmpty() && offhand.getItem() instanceof ItemBlackHoleBox) {
|
||||
profiler.startSection("blackHoleBox_off");
|
||||
ItemBlackHoleBox.renderHUD(event.getResolution(), mc.player, offhand);
|
||||
profiler.endSection();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package pulxes.ab.client.core.handler;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
|
||||
public class IconMiscHandler {
|
||||
|
||||
public static final IconMiscHandler INSTANCE = new IconMiscHandler();
|
||||
|
||||
public TextureAtlasSprite alphirinePortal;
|
||||
public TextureAtlasSprite elvenSpark;
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTextureStitch(TextureStitchEvent.Pre evt) {
|
||||
this.alphirinePortal = IconHelper.forName(evt.getMap(), "alphirine_portal", "blocks");
|
||||
this.elvenSpark = IconHelper.forName(evt.getMap(), "elven_spark", "items");
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,7 @@ public class PlayerItemUsingSound {
|
||||
if(!soundsList.isEmpty())
|
||||
for(int i = 0; i < soundsList.size(); i++) {
|
||||
PlayerItemUsingSound playerSound = soundsList.get(i);
|
||||
if(playerSound.player.isEntityEqual(player) && mc.getSoundHandler().isSoundPlaying(playerSound.sound)) {
|
||||
if(playerSound.player.isEntityEqual(player)) {
|
||||
if(playerSound.maxTick != 0 && playerSound.maxTick <= playerSound.tick && !playerSound.isDeadingSound) {
|
||||
playerSound.isDeadingSound = true;
|
||||
setSound(player, soundIn, category, volume, pitch, maxTick, hasCheckUse);
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package pulxes.ab.client.core.handler;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.event.RenderTooltipEvent;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import pulxes.ab.AdvancedBotany;
|
||||
import pulxes.ab.api.IRankItem;
|
||||
|
||||
@EventBusSubscriber(value = {Side.CLIENT}, modid = AdvancedBotany.MODID)
|
||||
public class TooltipDisplayHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onToolTipRender(RenderTooltipEvent.PostText evt) {
|
||||
if(evt.getStack().isEmpty())
|
||||
return;
|
||||
ItemStack stack = evt.getStack();
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
int width = evt.getWidth();
|
||||
int height = 3;
|
||||
int tooltipX = evt.getX();
|
||||
int tooltipY = evt.getY() - 4;
|
||||
FontRenderer font = evt.getFontRenderer();
|
||||
if(stack.getItem() instanceof IRankItem)
|
||||
drawRankDisplay(stack, tooltipX, tooltipY, width, height, font);
|
||||
}
|
||||
|
||||
private static void drawRankDisplay(ItemStack stack, int mouseX, int mouseY, int width, int height, FontRenderer font) {
|
||||
IRankItem item = (IRankItem)stack.getItem();
|
||||
int level = item.getLevel(stack);
|
||||
int max = item.getLevels()[Math.min(item.getLevels().length - 1, level + 1)];
|
||||
boolean ss = (level >= item.getLevels().length - 1);
|
||||
int curr = item.getMana(stack);
|
||||
float percent = (level == 0) ? 0.0F : (curr / max);
|
||||
int rainbowWidth = Math.min(width - (ss ? 0 : 1), (int)(width * percent));
|
||||
float huePer = (width == 0) ? 0.0F : (1.0F / width);
|
||||
float hueOff = (vazkii.botania.client.core.handler.ClientTickHandler.ticksInGame + vazkii.botania.client.core.handler.ClientTickHandler.partialTicks) * 0.01F;
|
||||
GlStateManager.disableDepth();
|
||||
Gui.drawRect(mouseX - 1, mouseY - height - 1, mouseX + width + 1, mouseY, -16777216);
|
||||
for(int i = 0; i < rainbowWidth; i++)
|
||||
Gui.drawRect(mouseX + i, mouseY - height, mouseX + i + 1, mouseY, Color.HSBtoRGB(hueOff + huePer * i, 1.0F, 1.0F));
|
||||
Gui.drawRect(mouseX + rainbowWidth, mouseY - height, mouseX + width, mouseY, -11184811);
|
||||
String rank = I18n.format("botania.rank" + level, new Object[0]).replaceAll("&", "\u00A7");
|
||||
GL11.glPushAttrib(64);
|
||||
GlStateManager.disableLighting();
|
||||
font.drawStringWithShadow(rank, mouseX, (mouseY - 12), 16777215);
|
||||
if(!ss) {
|
||||
rank = I18n.format("botania.rank" + (level + 1), new Object[0]).replaceAll("&", "\u00A7");
|
||||
font.drawStringWithShadow(rank, (mouseX + width - font.getStringWidth(rank)), (mouseY - 12), 16777215);
|
||||
}
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.enableDepth();
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,53 @@
|
||||
package pulxes.ab.client.core.helper;
|
||||
|
||||
import java.util.function.IntFunction;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import pulxes.ab.AdvancedBotany;
|
||||
import vazkii.botania.client.core.proxy.ClientProxy;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
|
||||
public class ClientHelper {
|
||||
|
||||
public static void registerCustomItemblock(Block b, String path) {
|
||||
registerCustomItemblock(b, 1, i -> path);
|
||||
}
|
||||
|
||||
public static void registerCustomItemblock(Block b, int maxExclusive, IntFunction<String> metaToPath) {
|
||||
Item item = Item.getItemFromBlock(b);
|
||||
for (int i = 0; i < maxExclusive; i++)
|
||||
ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(AdvancedBotany.MODID + ":itemblock/" + (String)metaToPath.apply(i), "inventory"));
|
||||
}
|
||||
|
||||
public static void setLightmapTextureCoords() {
|
||||
int light = 15728880;
|
||||
int lightmapX = light % 65536;
|
||||
int lightmapY = light / 65536;
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY);
|
||||
}
|
||||
|
||||
public static void renderIcon(TextureAtlasSprite icon, int light) {
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
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;
|
||||
tessellator.getBuffer().begin(7, ClientProxy.POSITION_TEX_LMAP);
|
||||
tessellator.getBuffer().pos((0.0F - f5), (0.0F - f6), 0.0D).tex(f, f3).lightmap(light, light).endVertex();
|
||||
tessellator.getBuffer().pos((f4 - f5), (0.0F - f6), 0.0D).tex(f1, f3).lightmap(light, light).endVertex();
|
||||
tessellator.getBuffer().pos((f4 - f5), (f4 - f6), 0.0D).tex(f1, f2).lightmap(light, light).endVertex();
|
||||
tessellator.getBuffer().pos((0.0F - f5), (f4 - f6), 0.0D).tex(f, f2).lightmap(light, light).endVertex();
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
public static Vector3 setRotation(float angel, float vX, float vY, float vZ, Vector3 v3) {
|
||||
Vector3 rVec = new Vector3(vX, vY, vZ);
|
||||
|
||||
@@ -1,17 +1,31 @@
|
||||
package pulxes.ab.client.core.proxy;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import pulxes.ab.client.core.handler.ClientTickHandler;
|
||||
import pulxes.ab.client.core.handler.IconMiscHandler;
|
||||
import pulxes.ab.client.core.handler.RenderColorHandler;
|
||||
import pulxes.ab.client.render.tile.RenderTileNidavellirForge;
|
||||
import pulxes.ab.common.block.tile.TileNidavellirForge;
|
||||
import pulxes.ab.common.core.proxy.CommonProxy;
|
||||
import pulxes.ab.common.entity.EntityAlphirinePortal;
|
||||
import pulxes.ab.common.entity.EntityElvenSpark;
|
||||
|
||||
public class ClientProxy extends CommonProxy {
|
||||
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
super.preInit(event);
|
||||
MinecraftForge.EVENT_BUS.register(IconMiscHandler.INSTANCE);
|
||||
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileNidavellirForge.class, new RenderTileNidavellirForge());
|
||||
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityAlphirinePortal.class, pulxes.ab.client.render.entity.RenderEntityAlphirinePortal::new);
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityElvenSpark.class, pulxes.ab.client.render.entity.RenderEntityElvenSpark::new);
|
||||
}
|
||||
|
||||
public void init(FMLInitializationEvent event) {
|
||||
@@ -23,4 +37,4 @@ public class ClientProxy extends CommonProxy {
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
super.postInit(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package pulxes.ab.client.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelBox;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class ModelNidavellirForge extends ModelBase {
|
||||
|
||||
private final ModelRenderer bottomAnvil;
|
||||
private final ModelRenderer topAnvil;
|
||||
|
||||
public ModelNidavellirForge() {
|
||||
textureWidth = 48;
|
||||
textureHeight = 48;
|
||||
|
||||
bottomAnvil = new ModelRenderer(this);
|
||||
bottomAnvil.setRotationPoint(0.0F, 24.0F, 0.0F);
|
||||
bottomAnvil.cubeList.add(new ModelBox(bottomAnvil, 32, 26, -3.0F, -1.0F, -4.0F, 6, 1, 1, 0.0F));
|
||||
bottomAnvil.cubeList.add(new ModelBox(bottomAnvil, 0, 31, -5.0F, -1.0F, -3.0F, 12, 1, 6, 0.0F));
|
||||
bottomAnvil.cubeList.add(new ModelBox(bottomAnvil, 32, 17, -2.0F, -3.0F, -2.0F, 4, 1, 4, 0.0F));
|
||||
bottomAnvil.cubeList.add(new ModelBox(bottomAnvil, 0, 8, -4.0F, -2.0F, -3.0F, 8, 1, 6, 0.0F));
|
||||
bottomAnvil.cubeList.add(new ModelBox(bottomAnvil, 32, 23, -3.0F, -1.0F, 3.0F, 6, 1, 1, 0.0F));
|
||||
|
||||
topAnvil = new ModelRenderer(this);
|
||||
topAnvil.setRotationPoint(0.0F, 26.0F, 0.0F);
|
||||
topAnvil.cubeList.add(new ModelBox(topAnvil, 0, 23, -6.5F, -11.0F, -3.0F, 12, 2, 6, 0.0F));
|
||||
topAnvil.cubeList.add(new ModelBox(topAnvil, 0, 38, -5.5F, -12.0F, -4.0F, 13, 2, 8, 0.0F));
|
||||
topAnvil.cubeList.add(new ModelBox(topAnvil, 0, 15, -5.5F, -9.0F, -3.0F, 9, 2, 6, 0.0F));
|
||||
topAnvil.cubeList.add(new ModelBox(topAnvil, 17, 0, -4.5F, -11.0F, 2.5F, 7, 3, 1, 0.0F));
|
||||
topAnvil.cubeList.add(new ModelBox(topAnvil, 0, 0, -4.5F, -11.0F, -3.5F, 7, 3, 1, 0.0F));
|
||||
topAnvil.cubeList.add(new ModelBox(topAnvil, 30, 12, -2.5F, -7.0F, -2.0F, 5, 1, 4, 0.0F));
|
||||
}
|
||||
|
||||
public void renderBottom() {
|
||||
bottomAnvil.render(0.0625f);
|
||||
}
|
||||
|
||||
public void renderTop() {
|
||||
topAnvil.render(0.0625f);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package pulxes.ab.client.render.entity;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import pulxes.ab.client.core.handler.IconMiscHandler;
|
||||
import pulxes.ab.client.core.helper.ClientHelper;
|
||||
import pulxes.ab.common.entity.EntityAlphirinePortal;
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
|
||||
public class RenderEntityAlphirinePortal extends Render<EntityAlphirinePortal> {
|
||||
|
||||
public RenderEntityAlphirinePortal(RenderManager renderManager) {
|
||||
super(renderManager);
|
||||
}
|
||||
|
||||
public void doRender(@Nonnull EntityAlphirinePortal entity, double x, double y, double z, float fl1, float par9) {
|
||||
double worldTime = (entity.world == null) ? 0.0D : (ClientTickHandler.ticksInGame + fl1);
|
||||
if(entity != null)
|
||||
worldTime += (new Random(((int)entity.posX ^ (int)entity.posY ^ (int)entity.posZ))).nextInt(360);
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
float lbx = OpenGlHelper.lastBrightnessX;
|
||||
float lby = OpenGlHelper.lastBrightnessY;
|
||||
float burn = Math.min(1.0f, entity.ticksExisted * 0.0461f);
|
||||
float scale = Math.max(0.0f, (float)(burn + (Math.sin(worldTime / 4.2f) / 10.0f))) / 3.14f;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
GlStateManager.translate(x, y, z);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(770, 771);
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.enableRescaleNormal();
|
||||
GlStateManager.scale(scale, scale, scale);
|
||||
GlStateManager.rotate(180.0f - this.renderManager.playerViewY, 0.0f, 1.0f, 0.0f);
|
||||
GlStateManager.rotate(-this.renderManager.playerViewX, 1.0f, 0.0f, 0.0f);
|
||||
GlStateManager.disableCull();
|
||||
mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
ClientHelper.setLightmapTextureCoords();
|
||||
ClientHelper.renderIcon(IconMiscHandler.INSTANCE.alphirinePortal, 220);
|
||||
GlStateManager.enableCull();
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableLighting();
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lbx, lby);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
protected ResourceLocation getEntityTexture(@Nonnull EntityAlphirinePortal entity) {
|
||||
return TextureMap.LOCATION_BLOCKS_TEXTURE;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package pulxes.ab.client.render.entity;
|
||||
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import pulxes.ab.client.core.handler.IconMiscHandler;
|
||||
import pulxes.ab.common.entity.EntityElvenSpark;
|
||||
import vazkii.botania.client.core.handler.MiscellaneousIcons;
|
||||
import vazkii.botania.client.render.entity.RenderSparkBase;
|
||||
|
||||
public class RenderEntityElvenSpark extends RenderSparkBase<EntityElvenSpark> {
|
||||
|
||||
public RenderEntityElvenSpark(RenderManager manager) {
|
||||
super(manager);
|
||||
}
|
||||
|
||||
public TextureAtlasSprite getBaseIcon(EntityElvenSpark entity) {
|
||||
return IconMiscHandler.INSTANCE.elvenSpark;
|
||||
}
|
||||
|
||||
public TextureAtlasSprite getSpinningIcon(EntityElvenSpark entity) {
|
||||
int upgrade = entity.getUpgrade().ordinal() - 1;
|
||||
return (upgrade >= 0 && upgrade < MiscellaneousIcons.INSTANCE.sparkUpgradeIcons.length) ? MiscellaneousIcons.INSTANCE.sparkUpgradeIcons[upgrade] : null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
package pulxes.ab.client.render.tile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.entity.RenderEntityItem;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import pulxes.ab.AdvancedBotany;
|
||||
import pulxes.ab.client.model.ModelNidavellirForge;
|
||||
import pulxes.ab.common.block.tile.TileNidavellirForge;
|
||||
import pulxes.ab.common.lib.register.BlockListAB;
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
|
||||
public class RenderTileNidavellirForge extends TileEntitySpecialRenderer<TileNidavellirForge> {
|
||||
|
||||
private static final ResourceLocation TEXTURE = new ResourceLocation(AdvancedBotany.MODID + ":textures/model/nidavellir_forge.png");
|
||||
private static final ModelNidavellirForge MODEL = new ModelNidavellirForge();
|
||||
private static final float[] ROTATIONS = new float[] { 180.0F, 0.0F, 90.0F, 270.0F };
|
||||
private List<EntityItem> entityList = null;
|
||||
private RenderEntityItem itemRenderer = null;
|
||||
|
||||
public void render(@Nullable TileNidavellirForge forge, double x, double y, double z, float pticks, int digProgress, float unused) {
|
||||
if(forge != null && (!forge.getWorld().isBlockLoaded(forge.getPos(), false) || forge.getWorld().getBlockState(forge.getPos()).getBlock() != BlockListAB.nidavellirForge))
|
||||
return;
|
||||
|
||||
int meta = 0;
|
||||
double worldTime = 0.0D;
|
||||
float indetY = 0.0f;
|
||||
|
||||
if(forge != null && forge.getWorld() != null) {
|
||||
meta = forge.getBlockMetadata();
|
||||
worldTime = ClientTickHandler.ticksInGame + pticks + (new Random((forge.getPos().getX() ^ forge.getPos().getY() ^ forge.getPos().getZ()))).nextInt(360);
|
||||
indetY = (float)(Math.sin(worldTime / 18.0D) / 24.0D);
|
||||
if(entityList == null) {
|
||||
List<EntityItem> list = new ArrayList();
|
||||
for(int i = 0; i < forge.getSizeInventory(); i++)
|
||||
list.add(new EntityItem(forge.getWorld()));
|
||||
entityList = list;
|
||||
}
|
||||
if(itemRenderer == null) {
|
||||
itemRenderer = new RenderEntityItem(Minecraft.getMinecraft().getRenderManager(), Minecraft.getMinecraft().getRenderItem()) {
|
||||
public boolean shouldBob() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
GlStateManager.enableRescaleNormal();
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
(Minecraft.getMinecraft()).renderEngine.bindTexture(TEXTURE);
|
||||
GlStateManager.translate(x, y, z);
|
||||
GlStateManager.translate(0.5f, 1.5f, 0.5f);
|
||||
GlStateManager.rotate(180.0f, 1.0f, 0.0f, 1.0f);
|
||||
GlStateManager.rotate(ROTATIONS[Math.max(Math.min(ROTATIONS.length - 1, meta - 2), 0)], 0.0F, 1.0F, 0.0F);
|
||||
MODEL.renderBottom();
|
||||
GlStateManager.translate(0.0f, indetY, 0.0f);
|
||||
MODEL.renderTop();
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F);
|
||||
GlStateManager.enableRescaleNormal();
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
if(forge != null && forge.getWorld() != null) {
|
||||
int items = 0;
|
||||
for(int i = 1; i < forge.getSizeInventory() && !forge.getItemHandler().getStackInSlot(i).isEmpty(); i++)
|
||||
items++;
|
||||
float[] angles = new float[forge.getSizeInventory() - 1];
|
||||
float anglePer = 360.0F / items;
|
||||
float totalAngle = 0.0F;
|
||||
for(int i = 0; i < angles.length; i++)
|
||||
angles[i] = totalAngle += anglePer;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
GlStateManager.translate(x + 0.5F, y + 0.75F, z + 0.5F);
|
||||
GlStateManager.scale(0.4F, 0.4F, 0.4F);
|
||||
|
||||
if(entityList != null) {
|
||||
|
||||
ItemStack resultStack = forge.getItemHandler().getStackInSlot(0);
|
||||
if(!resultStack.isEmpty()) {
|
||||
|
||||
entityList.get(0).setItem(resultStack);
|
||||
entityList.get(0).hoverStart = 0;
|
||||
|
||||
float yPos = MathHelper.sin((ClientTickHandler.ticksInGame + pticks) / 8.0F) * 0.05F + 0.1F;
|
||||
float angelRotate = ((ClientTickHandler.ticksInGame + pticks) / 20.0F) * 57.295776F;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
GlStateManager.scale(1.5F, 1.5F, 1.5F);
|
||||
GlStateManager.translate(0.0f, yPos - indetY, 0.0f);
|
||||
GlStateManager.rotate(angelRotate, 0.0f, 1.0f, 0.0f);
|
||||
itemRenderer.doRender(entityList.get(0), 0.0D, 0.0D, 0.0D, 1.0F, 0.0f);
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
for(int i = 1; i < entityList.size(); i++) {
|
||||
ItemStack slotStack = forge.getItemHandler().getStackInSlot(i);
|
||||
|
||||
if(slotStack.isEmpty())
|
||||
continue;
|
||||
|
||||
entityList.get(i).setItem(slotStack);
|
||||
entityList.get(i).hoverStart = 0;
|
||||
|
||||
float yPos = MathHelper.sin((ClientTickHandler.ticksInGame + pticks + i * 7) / 8.0F) * 0.05F + 0.1F;
|
||||
float angelRotate = ((ClientTickHandler.ticksInGame + pticks + i * 7) / 20.0F) * 57.295776F;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
GlStateManager.rotate(angles[i - 1], 0.0F, 1.0F, 0.0F);
|
||||
GlStateManager.translate(1.35F, 0.0F, 0.25F);
|
||||
GlStateManager.translate(0.0f, yPos, 0.0f);
|
||||
GlStateManager.rotate(angelRotate, 0.0f, 1.0f, 0.0f);
|
||||
itemRenderer.doRender(entityList.get(i), 0.0D, 0.0D, 0.0D, 1.0F, 0.0f);
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package pulxes.ab.common.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import pulxes.ab.AdvancedBotany;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
import vazkii.botania.client.render.IModelRegister;
|
||||
|
||||
public class BlockMod extends Block implements IModelRegister {
|
||||
|
||||
public BlockMod(Material material, String name) {
|
||||
super(material);
|
||||
this.setUnlocalizedName(name);
|
||||
this.setRegistryName(new ResourceLocation(AdvancedBotany.MODID, name));
|
||||
if(registerInCreative())
|
||||
this.setCreativeTab(AdvancedBotany.tabAB);
|
||||
}
|
||||
|
||||
protected boolean registerInCreative() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerModels() {
|
||||
if(Item.getItemFromBlock(this) != Items.AIR)
|
||||
ModelHandler.registerBlockToState(this, 0, getDefaultState());
|
||||
}
|
||||
|
||||
public boolean eventReceived(IBlockState state, World world, BlockPos pos, int id, int param) {
|
||||
super.eventReceived(state, world, pos, id, param);
|
||||
TileEntity tileentity = world.getTileEntity(pos);
|
||||
return (tileentity != null && tileentity.receiveClientEvent(id, param));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
package pulxes.ab.common.block;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.BlockFaceShape;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.statemap.IStateMapper;
|
||||
import net.minecraft.client.renderer.block.statemap.StateMap;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import pulxes.ab.client.core.helper.ClientHelper;
|
||||
import pulxes.ab.common.block.tile.TileNidavellirForge;
|
||||
import pulxes.ab.common.lib.LibBlockNames;
|
||||
import vazkii.botania.api.internal.VanillaPacketDispatcher;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.common.block.tile.TileSimpleInventory;
|
||||
import vazkii.botania.common.core.helper.InventoryHelper;
|
||||
|
||||
public class BlockNidavellirForge extends BlockMod {
|
||||
|
||||
private static final AxisAlignedBB[] AABB;
|
||||
|
||||
static {
|
||||
double d = 0.1875F;
|
||||
double d1 = 0.0625F;
|
||||
AABB = new AxisAlignedBB[4];
|
||||
AABB[0] = new AxisAlignedBB(d, 0.0D, 0.0D, 1.0D - d, 0.75D, 1.0D - d1);
|
||||
AABB[1] = new AxisAlignedBB(d, 0.0D, d1, 1.0D - d, 0.75D, 1.0D);
|
||||
AABB[2] = new AxisAlignedBB(0.0D, 0.0D, d, 1.0D - d1, 0.75D, 1.0D - d);
|
||||
AABB[3] = new AxisAlignedBB(d1, 0.0D, d, 1.0D, 0.75D, 1.0D - d);
|
||||
}
|
||||
|
||||
public BlockNidavellirForge() {
|
||||
super(Material.ROCK, LibBlockNames.NIDAVELLIR_FORGE);
|
||||
this.setHardness(3.0F);
|
||||
this.setSoundType(SoundType.STONE);
|
||||
this.setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, new IProperty[] { BotaniaStateProps.CARDINALS });
|
||||
}
|
||||
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return (state.getValue(BotaniaStateProps.CARDINALS)).getIndex();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public AxisAlignedBB getBoundingBox(@Nonnull IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
int meta = Math.max(0, Math.min(state.getBlock().getMetaFromState(state) - 2, AABB.length - 1));
|
||||
return AABB[meta];
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
if(meta < 2 || meta > 5)
|
||||
meta = 2;
|
||||
return getDefaultState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.getFront(meta));
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
|
||||
world.setBlockState(pos, state.withProperty(BotaniaStateProps.CARDINALS, placer.getHorizontalFacing()), 2);
|
||||
}
|
||||
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing s, float xs, float ys, float zs) {
|
||||
if(world.isRemote)
|
||||
return true;
|
||||
TileNidavellirForge forge = (TileNidavellirForge)world.getTileEntity(pos);
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if(player.isSneaking()) {
|
||||
if(!forge.getItemHandler().getStackInSlot(0).isEmpty()) {
|
||||
ItemStack copy = forge.getItemHandler().getStackInSlot(0).copy();
|
||||
ItemHandlerHelper.giveItemToPlayer(player, copy);
|
||||
forge.getItemHandler().setStackInSlot(0, ItemStack.EMPTY);
|
||||
player.world.updateComparatorOutputLevel(forge.getPos(), null);
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(forge);
|
||||
return true;
|
||||
}
|
||||
InventoryHelper.withdrawFromInventory(forge, player);
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(forge);
|
||||
return true;
|
||||
} else {
|
||||
if(!stack.isEmpty())
|
||||
return forge.addItem(player, stack, false);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void breakBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state) {
|
||||
TileSimpleInventory inv = (TileSimpleInventory)world.getTileEntity(pos);
|
||||
InventoryHelper.dropInventory(inv, world, state, pos);
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||
return EnumBlockRenderType.ENTITYBLOCK_ANIMATED;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public TileEntity createTileEntity(@Nonnull World world, @Nonnull IBlockState state) {
|
||||
return new TileNidavellirForge();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerModels() {
|
||||
ModelLoader.setCustomStateMapper(this, (new StateMap.Builder()).ignore(new IProperty[] { (IProperty)BotaniaStateProps.CARDINALS }).build());
|
||||
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(this), 0, TileNidavellirForge.class);
|
||||
ClientHelper.registerCustomItemblock(this, LibBlockNames.NIDAVELLIR_FORGE);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public BlockFaceShape getBlockFaceShape(IBlockAccess world, IBlockState state, BlockPos pos, EnumFacing side) {
|
||||
return BlockFaceShape.UNDEFINED;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package pulxes.ab.common.block.subtile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.subtile.SubTileEntity;
|
||||
import vazkii.botania.api.subtile.SubTileFunctional;
|
||||
import vazkii.botania.api.subtile.SubTileGenerating;
|
||||
import vazkii.botania.api.subtile.signature.SubTileSignature;
|
||||
|
||||
public class ABSubTileSignature implements SubTileSignature {
|
||||
|
||||
private final String name;
|
||||
|
||||
public ABSubTileSignature(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getUnlocalizedNameForStack(ItemStack stack) {
|
||||
return unlocalizedName("");
|
||||
}
|
||||
|
||||
public String getUnlocalizedLoreTextForStack(ItemStack stack) {
|
||||
return unlocalizedName(".reference");
|
||||
}
|
||||
|
||||
private String unlocalizedName(String end) {
|
||||
return "tile.ab:flower." + this.name + end;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
Class<? extends SubTileEntity> clazz = BotaniaAPI.getSubTileMapping(this.name);
|
||||
if(clazz == null)
|
||||
return "uwotm8";
|
||||
if(SubTileGenerating.class.isAssignableFrom(clazz))
|
||||
return "botania.flowerType.generating";
|
||||
if(SubTileFunctional.class.isAssignableFrom(clazz))
|
||||
return "botania.flowerType.functional";
|
||||
return "botania.flowerType.misc";
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addTooltip(ItemStack stack, World world, List<String> tooltip) {
|
||||
tooltip.add(TextFormatting.BLUE + I18n.format(getType(), new Object[0]));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package pulxes.ab.common.block.subtile;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import pulxes.ab.api.AdvancedBotanyAPI;
|
||||
import pulxes.ab.api.recipe.RecipeAncientAlphirine;
|
||||
import pulxes.ab.common.entity.EntityAlphirinePortal;
|
||||
import pulxes.ab.common.lib.register.lexicon.LexiconListAB;
|
||||
import vazkii.botania.api.subtile.SubTileFunctional;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.item.ItemLexicon;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.block.ItemBlockModSlab;
|
||||
|
||||
public class SubTileAncientAlphirine extends SubTileFunctional {
|
||||
|
||||
private static final int MANA_REQUARE = 2500;
|
||||
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
List<EntityItem> items = supertile.getWorld().getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(this.supertile.getPos().add(-1, -1, -1), this.supertile.getPos().add(2, 1, 2)));
|
||||
if(ticksExisted % 10 == 0 && mana >= MANA_REQUARE) {
|
||||
label666: for(EntityItem item : items) {
|
||||
if(item.isDead || !(item.getItem().getCount() >= 1))
|
||||
continue;
|
||||
else if(item.getItem().getItem() == ModItems.lexicon && !((ItemLexicon)item.getItem().getItem()).isKnowledgeUnlocked(item.getItem(), LexiconListAB.KNOWLEDGE_FORGOTTEN)) {
|
||||
ItemStack unlockedForgottenLexicon = item.getItem().copy();
|
||||
((ItemLexicon)item.getItem().getItem()).unlockKnowledge(unlockedForgottenLexicon, LexiconListAB.KNOWLEDGE_FORGOTTEN);
|
||||
doAlphirineCraft(item, -1, unlockedForgottenLexicon);
|
||||
break label666;
|
||||
}
|
||||
for(RecipeAncientAlphirine recipe : AdvancedBotanyAPI.alphirineRecipes) {
|
||||
if(recipe.matches(item.getItem())) {
|
||||
doAlphirineCraft(item, recipe.getChance(), recipe.getOutput().copy());
|
||||
break label666;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void doAlphirineCraft(EntityItem item, int chance, ItemStack result) {
|
||||
if(!supertile.getWorld().isRemote) {
|
||||
if(chance == -1 || supertile.getWorld().rand.nextInt(110) <= chance) {
|
||||
spawnPortal(supertile.getWorld(), result, supertile.getPos().getX() + 0.5f, supertile.getPos().getY(), supertile.getPos().getZ() + 0.5f);
|
||||
mana -= MANA_REQUARE;
|
||||
} else
|
||||
mana -= MANA_REQUARE / 10;
|
||||
item.getItem().shrink(1);
|
||||
sync();
|
||||
} else {
|
||||
float m = 0.0375F;
|
||||
for(int i = 0; i < 16; i++) {
|
||||
float mx = (float)(Math.random() - 0.5D) * m;
|
||||
float my = (float)(Math.random() - 0.5D) * m;
|
||||
float mz = (float)(Math.random() - 0.5D) * m;
|
||||
Color color = new Color(Color.HSBtoRGB(0.1583F, (float)Math.random() * 0.5F + 0.5F, 1.0f));
|
||||
Botania.proxy.wispFX(item.posX, item.posY + 0.5f, item.posZ, (float)(color.getRed() / 255.0f), (float)(color.getGreen() / 255.0f), (float)(color.getBlue() / 255.0f), (float)(0.1f + (Math.random() * 0.12f)), mx, my, mz, 0.7f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void spawnPortal(World world, ItemStack stack, float posX, float posY, float posZ) {
|
||||
EntityAlphirinePortal portal = new EntityAlphirinePortal(world);
|
||||
float itemX = (float)(posX + (Math.random() * 2.0f - 1.0f));
|
||||
float itemY = (float)(posY + 1.2f + (Math.random() - 0.5f));
|
||||
float itemZ = (float)(posZ + (Math.random() * 2.0f - 1.0f));
|
||||
portal.setPosition(itemX, itemY, itemZ);
|
||||
portal.setItemStack(stack);
|
||||
world.spawnEntity(portal);
|
||||
}
|
||||
|
||||
public int getMaxMana() {
|
||||
return 80000;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return 0xd0bf58;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,261 @@
|
||||
package pulxes.ab.common.block.tile;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import pulxes.ab.api.AdvancedBotanyAPI;
|
||||
import pulxes.ab.api.recipe.RecipeNidavellirForge;
|
||||
import vazkii.botania.api.internal.VanillaPacketDispatcher;
|
||||
import vazkii.botania.api.mana.spark.ISparkAttachable;
|
||||
import vazkii.botania.api.mana.spark.ISparkEntity;
|
||||
import vazkii.botania.api.mana.spark.SparkHelper;
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.tile.TileSimpleInventory;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
|
||||
public class TileNidavellirForge extends TileSimpleInventory implements ITickable, ISparkAttachable {
|
||||
|
||||
private int wasMana;
|
||||
private int mana;
|
||||
public int manaToGet;
|
||||
private RecipeNidavellirForge currentRecipe;
|
||||
private int recipeID;
|
||||
public boolean requestUpdate;
|
||||
|
||||
public void update() {
|
||||
if(!world.isRemote)
|
||||
updateServer();
|
||||
else
|
||||
doParticle(pos.getX(), pos.getY(), pos.getZ(), (float)mana / (float)manaToGet, recipeID);
|
||||
ISparkEntity spark = getAttachedSpark();
|
||||
if(spark != null) {
|
||||
List<ISparkEntity> sparkEntities = SparkHelper.getSparksAround(world, pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D);
|
||||
for (ISparkEntity otherSpark : sparkEntities) {
|
||||
if(spark == otherSpark)
|
||||
continue;
|
||||
if(otherSpark.getAttachedTile() != null && otherSpark.getAttachedTile() instanceof vazkii.botania.api.mana.IManaPool)
|
||||
otherSpark.registerTransfer(spark);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateServer() {
|
||||
wasMana = mana;
|
||||
|
||||
if(requestUpdate)
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this);
|
||||
boolean hasUpdate = false;
|
||||
|
||||
List<EntityItem> items = world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(pos, pos.add(1, 1, 1)));
|
||||
for(EntityItem item : items)
|
||||
if(!item.isDead && !item.getItem().isEmpty()) {
|
||||
ItemStack stack = item.getItem();
|
||||
hasUpdate = addItem(null, stack, true);
|
||||
}
|
||||
|
||||
int wasManaToGet = manaToGet;
|
||||
boolean hasCraft = false;
|
||||
int recipeID = 0;
|
||||
|
||||
for(RecipeNidavellirForge recipe : AdvancedBotanyAPI.forgeRecipes) {
|
||||
if(recipe.matches(itemHandler)) {
|
||||
this.recipeID = recipeID;
|
||||
if(mana > 0 && isFull()) {
|
||||
ItemStack output = recipe.getOutput().copy();
|
||||
recieveMana(-recipe.getManaUsage());
|
||||
manaToGet = 0;
|
||||
for(int i = 1; i < getSizeInventory(); i++)
|
||||
itemHandler.getStackInSlot(i).shrink(1);
|
||||
if(itemHandler.getStackInSlot(0).isEmpty())
|
||||
itemHandler.setStackInSlot(0, output);
|
||||
else
|
||||
itemHandler.getStackInSlot(0).grow(1);
|
||||
hasUpdate = true;
|
||||
// worldObj.playSoundEffect(xCoord, yCoord, zCoord, "botania:terrasteelCraft", 1.0F, 2.0F);
|
||||
break;
|
||||
} else {
|
||||
if(itemHandler.getStackInSlot(0).isEmpty() || (isItemEqual(recipe.getOutput(), itemHandler.getStackInSlot(0)) && itemHandler.getStackInSlot(0).getCount() < itemHandler.getStackInSlot(0).getMaxStackSize())) {
|
||||
manaToGet = recipe.getManaUsage();
|
||||
currentRecipe = recipe;
|
||||
hasCraft = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
recipeID++;
|
||||
}
|
||||
|
||||
if(!hasCraft) {
|
||||
currentRecipe = null;
|
||||
mana = 0;
|
||||
manaToGet = 0;
|
||||
}
|
||||
|
||||
if(world.getTotalWorldTime() % 20 == 0 && wasMana > 0 && mana != wasMana)
|
||||
hasUpdate = true;
|
||||
|
||||
if(manaToGet != wasManaToGet)
|
||||
hasUpdate = true;
|
||||
|
||||
requestUpdate = hasUpdate;
|
||||
}
|
||||
|
||||
public static void doParticle(int posX, int posY, int posZ, float craftProcess, int recipeID) {
|
||||
if(craftProcess > 0.0f) {
|
||||
float size = 0.4f;
|
||||
double tickIncrement = 360.0D / 3;
|
||||
double wticks = tickIncrement;
|
||||
|
||||
double radius = (1.0f - craftProcess) * 0.525f;
|
||||
float rotate = 82.0f + (craftProcess * 360.0f);
|
||||
double gravitation = Math.cos(1.0f - craftProcess) * 0.4f;
|
||||
|
||||
int color = 0x24cce0;
|
||||
if(recipeID > 0 && !AdvancedBotanyAPI.forgeRecipes.isEmpty())
|
||||
color = AdvancedBotanyAPI.forgeRecipes.get(Math.min(AdvancedBotanyAPI.forgeRecipes.size(), recipeID)).getColor();
|
||||
float hsb[] = Color.RGBtoHSB(color & 255, color >> 8 & 255, color >> 16 & 255, null);
|
||||
int color1 = Color.HSBtoRGB(hsb[0], hsb[1], craftProcess);
|
||||
float[] colorsfx = { (color1 & 255) / 255.0f, (color1 >> 8 & 255) / 255.0f, (color1 >> 16 & 255) / 255.0f };
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
double x = posX + Math.sin((rotate + wticks) * Math.PI / 180.0D) * radius + 0.5D;
|
||||
double y = posY + 0.7D + gravitation;
|
||||
double z = posZ + Math.cos((rotate + wticks) * Math.PI / 180.0D) * radius + 0.5D;
|
||||
|
||||
wticks += tickIncrement;
|
||||
|
||||
Botania.proxy.wispFX(x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], 0.425F * size, 0.0f, 0.27F);
|
||||
Botania.proxy.wispFX(x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], (float)Math.random() * 0.05F + 0.01F * size, (float)(Math.random() - 0.5D) * 0.05F, (float)(Math.random() - 0.5D) * 0.05F, (float)(Math.random() - 0.5D) * 0.05F, 0.9F);
|
||||
|
||||
if(craftProcess == 1.0F)
|
||||
for(int j = 0; j < 12; j++)
|
||||
Botania.proxy.wispFX(posX + 0.5D, posY + 1.1D, posZ + 0.5D, colorsfx[0], colorsfx[1], colorsfx[2], (float)Math.random() * 0.15F + 0.15F * size, (float)(Math.random() - 0.5D) * 0.125F * size, (float)(Math.random() - 0.5D) * 0.125F * size, (float)(Math.random() - 0.5D) * 0.125F * size, 0.8f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean addItem(@Nullable EntityPlayer player, ItemStack stack, boolean isDrop) {
|
||||
if(stack.getItem() == ModItems.twigWand || stack.getItem() == ModItems.lexicon)
|
||||
return false;
|
||||
for(int i = 1; i < getSizeInventory(); i++) {
|
||||
if(itemHandler.getStackInSlot(i).isEmpty()) {
|
||||
requestUpdate = true;
|
||||
ItemStack stackToAdd = stack.copy();
|
||||
int countToAdd = isDrop ? Math.min(Math.min(stackToAdd.getMaxStackSize(), stackToAdd.getCount()), itemHandler.getSlotLimit(i)) : 1;
|
||||
stackToAdd.setCount(countToAdd);
|
||||
itemHandler.setStackInSlot(i, stackToAdd);
|
||||
if(player == null || !player.capabilities.isCreativeMode)
|
||||
stack.shrink(countToAdd);
|
||||
break;
|
||||
} else {
|
||||
ItemStack slotStack = itemHandler.getStackInSlot(i);
|
||||
if(isItemEqual(slotStack, stack)) {
|
||||
int availableCount = slotStack.getMaxStackSize() - slotStack.getCount();
|
||||
if(availableCount > 0) {
|
||||
requestUpdate = true;
|
||||
ItemStack stackToAdd = stack.copy();
|
||||
int countToAdd = isDrop ? Math.min(availableCount, stackToAdd.getCount()) : 1;
|
||||
slotStack.grow(countToAdd);
|
||||
if(player == null || !player.capabilities.isCreativeMode)
|
||||
stack.shrink(countToAdd);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isItemEqual(ItemStack stack, ItemStack stack1) {
|
||||
return stack.isItemEqual(stack1) && ItemStack.areItemStackTagsEqual(stack, stack1);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbtt) {
|
||||
NBTTagCompound ret = super.writeToNBT(nbtt);
|
||||
nbtt.setBoolean("requestUpdate", requestUpdate);
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound nbtt) {
|
||||
super.readFromNBT(nbtt);
|
||||
this.requestUpdate = nbtt.getBoolean("requestUpdate");
|
||||
}
|
||||
|
||||
public void writePacketNBT(NBTTagCompound nbtt) {
|
||||
super.writePacketNBT(nbtt);
|
||||
nbtt.setInteger("mana", mana);
|
||||
nbtt.setInteger("manaToGet", manaToGet);
|
||||
nbtt.setInteger("recipeID", currentRecipe == null ? -1 : recipeID);
|
||||
}
|
||||
|
||||
public void readPacketNBT(NBTTagCompound nbtt) {
|
||||
super.readPacketNBT(nbtt);
|
||||
this.mana = nbtt.getInteger("mana");
|
||||
this.manaToGet = nbtt.getInteger("manaToGet");
|
||||
int recipeID = nbtt.getInteger("recipeID");
|
||||
if(recipeID == -1)
|
||||
this.currentRecipe = null;
|
||||
else
|
||||
this.currentRecipe = AdvancedBotanyAPI.forgeRecipes.get(recipeID);
|
||||
}
|
||||
|
||||
public int getSizeInventory() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
public int getCurrentMana() {
|
||||
return mana;
|
||||
}
|
||||
|
||||
public boolean isFull() {
|
||||
return mana >= manaToGet;
|
||||
}
|
||||
|
||||
public void recieveMana(int mana) {
|
||||
this.mana = Math.min(this.mana + mana, manaToGet);
|
||||
}
|
||||
|
||||
public boolean canRecieveManaFromBursts() {
|
||||
return !this.isFull();
|
||||
}
|
||||
|
||||
public boolean canAttachSpark(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void attachSpark(ISparkEntity entity) {}
|
||||
|
||||
public ISparkEntity getAttachedSpark() {
|
||||
List<Entity> sparks = this.world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(this.pos.up(), this.pos.up().add(1, 1, 1)), Predicates.instanceOf(ISparkEntity.class));
|
||||
if(sparks.size() == 1) {
|
||||
Entity e = sparks.get(0);
|
||||
return (ISparkEntity)e;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean areIncomingTranfersDone() {
|
||||
return isFull();
|
||||
}
|
||||
|
||||
public int getAvailableSpaceForMana() {
|
||||
return Math.max(0, manaToGet - getCurrentMana());
|
||||
}
|
||||
}
|
||||
@@ -17,9 +17,6 @@ public class AdvBotanyConfigHandler {
|
||||
public static double protectionFactorNebula = 1.0f;
|
||||
public static double damageFactorSpaceSword = 1.0f;
|
||||
public static int nebulaWandCooldownTick = 18;
|
||||
// public static int spreaderMaxMana = 128000;
|
||||
// public static int spreaderBurstMana = 32000;
|
||||
// public static String[] lockEntityListToHorn = new String[] {};
|
||||
public static String[] lockWorldNameNebulaRod = new String[] {};
|
||||
public static int limitXZCoords = 30000000;
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import pulxes.ab.AdvancedBotany;
|
||||
import pulxes.ab.common.core.network.S02PacketSpaceBladeDash;
|
||||
import pulxes.ab.common.core.network.S03PacketSpaceBladeBurst;
|
||||
import pulxes.ab.common.core.network.S00PacketSpaceBladeDash;
|
||||
import pulxes.ab.common.core.network.C00PacketSpaceBladeBurst;
|
||||
|
||||
public class NetworkHandler {
|
||||
|
||||
@@ -14,15 +14,15 @@ public class NetworkHandler {
|
||||
|
||||
public static void registerPackets() {
|
||||
int id = 0;
|
||||
NETWORK.registerMessage(S02PacketSpaceBladeDash.class, S02PacketSpaceBladeDash.class, id++, Side.CLIENT);
|
||||
NETWORK.registerMessage(S03PacketSpaceBladeBurst.class, S03PacketSpaceBladeBurst.class, id++, Side.SERVER);
|
||||
NETWORK.registerMessage(S00PacketSpaceBladeDash.class, S00PacketSpaceBladeDash.class, id++, Side.CLIENT);
|
||||
NETWORK.registerMessage(C00PacketSpaceBladeBurst.class, C00PacketSpaceBladeBurst.class, id++, Side.SERVER);
|
||||
}
|
||||
|
||||
public static void sendPacketToSpaceDash(EntityPlayerMP playerMP) {
|
||||
NETWORK.sendTo(new S02PacketSpaceBladeDash(), playerMP);
|
||||
NETWORK.sendTo(new S00PacketSpaceBladeDash(), playerMP);
|
||||
}
|
||||
|
||||
public static void sendPacketToSpaceBurst() {
|
||||
NETWORK.sendToServer(new S03PacketSpaceBladeBurst());
|
||||
NETWORK.sendToServer(new C00PacketSpaceBladeBurst());
|
||||
}
|
||||
}
|
||||
@@ -10,13 +10,13 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import pulxes.ab.common.item.equipment.ItemSpaceBlade;
|
||||
|
||||
public class S03PacketSpaceBladeBurst implements IMessage, IMessageHandler<S03PacketSpaceBladeBurst, IMessage> {
|
||||
public class C00PacketSpaceBladeBurst implements IMessage, IMessageHandler<C00PacketSpaceBladeBurst, IMessage> {
|
||||
|
||||
public void fromBytes(ByteBuf buf) {}
|
||||
|
||||
public void toBytes(ByteBuf buf) {}
|
||||
|
||||
public IMessage onMessage(S03PacketSpaceBladeBurst message, MessageContext ctx) {
|
||||
public IMessage onMessage(C00PacketSpaceBladeBurst message, MessageContext ctx) {
|
||||
EntityPlayerMP player = (ctx.getServerHandler()).player;
|
||||
player.mcServer.addScheduledTask(() -> ItemSpaceBlade.spaceBurstAttack(player));
|
||||
return null;
|
||||
@@ -9,15 +9,16 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import pulxes.ab.common.item.equipment.ItemSpaceBlade;
|
||||
|
||||
public class S02PacketSpaceBladeDash implements IMessage, IMessageHandler<S02PacketSpaceBladeDash, IMessage> {
|
||||
public class S00PacketSpaceBladeDash implements IMessage, IMessageHandler<S00PacketSpaceBladeDash, IMessage> {
|
||||
|
||||
public void fromBytes(ByteBuf buf) {}
|
||||
|
||||
public void toBytes(ByteBuf buf) {}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IMessage onMessage(S02PacketSpaceBladeDash message, MessageContext ctx) {
|
||||
public IMessage onMessage(S00PacketSpaceBladeDash message, MessageContext ctx) {
|
||||
ItemSpaceBlade.playerSpaceDash(Minecraft.getMinecraft().player);
|
||||
ItemSpaceBlade.doParticleDash();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package pulxes.ab.common.core.network;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import pulxes.ab.common.item.equipment.ItemSpaceBlade;
|
||||
|
||||
public class S01PacketNidavellirForgeCraft implements IMessage, IMessageHandler<S01PacketNidavellirForgeCraft, IMessage> {
|
||||
|
||||
private int posX;
|
||||
private int posY;
|
||||
private int posZ;
|
||||
|
||||
private int recipeID;
|
||||
private float craftProcess;
|
||||
|
||||
public void fromBytes(ByteBuf buf) {}
|
||||
|
||||
public void toBytes(ByteBuf buf) {}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IMessage onMessage(S01PacketNidavellirForgeCraft message, MessageContext ctx) {
|
||||
ItemSpaceBlade.playerSpaceDash(Minecraft.getMinecraft().player);
|
||||
ItemSpaceBlade.doParticleDash();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -7,17 +7,23 @@ import pulxes.ab.client.core.handler.RenderColorHandler;
|
||||
import pulxes.ab.common.core.handler.AdvBotanyConfigHandler;
|
||||
import pulxes.ab.common.core.handler.NetworkHandler;
|
||||
import pulxes.ab.common.lib.register.EntityListAB;
|
||||
import pulxes.ab.common.lib.register.FlowerListAB;
|
||||
import pulxes.ab.common.lib.register.ItemListAB;
|
||||
import pulxes.ab.common.lib.register.RecipeListAB;
|
||||
import pulxes.ab.common.lib.register.lexicon.LexiconListAB;
|
||||
|
||||
public class CommonProxy {
|
||||
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
EntityListAB.init();
|
||||
FlowerListAB.init();
|
||||
AdvBotanyConfigHandler.loadConfig(event.getSuggestedConfigurationFile());
|
||||
}
|
||||
|
||||
public void init(FMLInitializationEvent event) {
|
||||
NetworkHandler.registerPackets();
|
||||
RecipeListAB.init();
|
||||
LexiconListAB.init();
|
||||
}
|
||||
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package pulxes.ab.common.entity;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.datasync.DataParameter;
|
||||
import net.minecraft.network.datasync.DataSerializers;
|
||||
import net.minecraft.network.datasync.EntityDataManager;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.common.Botania;
|
||||
|
||||
public class EntityAlphirinePortal extends Entity {
|
||||
|
||||
private static final DataParameter<ItemStack> ITEM = EntityDataManager.createKey(EntityProjectileSpaceBurst.class, DataSerializers.ITEM_STACK);
|
||||
private static final ItemStack DEFAULT_STACK = new ItemStack(Items.AIR);
|
||||
|
||||
public EntityAlphirinePortal(World world) {
|
||||
super(world);
|
||||
setSize(1.0F, 1.0F);
|
||||
isImmuneToFire = true;
|
||||
}
|
||||
|
||||
protected void entityInit() {
|
||||
this.dataManager.register(ITEM, DEFAULT_STACK);
|
||||
}
|
||||
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
if(ticksExisted >= 40) {
|
||||
if(getItemStack() == DEFAULT_STACK)
|
||||
setDead();
|
||||
else if(!world.isRemote) {
|
||||
EntityItem itemResult = new EntityItem(world, posX, posY, posZ, getItemStack());
|
||||
world.spawnEntity(itemResult);
|
||||
setDead();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getItemStack() {
|
||||
return this.dataManager.get(ITEM);
|
||||
}
|
||||
|
||||
public void setItemStack(ItemStack stack) {
|
||||
this.dataManager.set(ITEM, stack);
|
||||
}
|
||||
|
||||
protected void readEntityFromNBT(NBTTagCompound nbtt) {
|
||||
ticksExisted = nbtt.getInteger("ticksExisted");
|
||||
ItemStack portalLoot = getItemStack().copy();
|
||||
portalLoot.writeToNBT(nbtt);
|
||||
}
|
||||
|
||||
protected void writeEntityToNBT(NBTTagCompound nbtt) {
|
||||
nbtt.setInteger("ticksExisted", ticksExisted);
|
||||
setItemStack(new ItemStack(nbtt));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,302 @@
|
||||
package pulxes.ab.common.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import baubles.api.BaublesApi;
|
||||
import gnu.trove.map.hash.TObjectIntHashMap;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.datasync.DataParameter;
|
||||
import net.minecraft.network.datasync.DataSerializers;
|
||||
import net.minecraft.network.datasync.EntityDataManager;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import pulxes.ab.common.lib.register.ItemListAB;
|
||||
import vazkii.botania.api.mana.IManaItem;
|
||||
import vazkii.botania.api.mana.IManaPool;
|
||||
import vazkii.botania.api.mana.spark.ISparkAttachable;
|
||||
import vazkii.botania.api.mana.spark.ISparkEntity;
|
||||
import vazkii.botania.api.mana.spark.SparkHelper;
|
||||
import vazkii.botania.api.mana.spark.SparkUpgradeType;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.network.PacketBotaniaEffect;
|
||||
import vazkii.botania.common.network.PacketHandler;
|
||||
|
||||
public class EntityElvenSpark extends Entity implements ISparkEntity {
|
||||
|
||||
private static final int TRANSFER_RATE = 24_000;
|
||||
private static final String TAG_UPGRADE = "upgrade";
|
||||
private static final String TAG_INVIS = "invis";
|
||||
private static final DataParameter<Integer> UPGRADE = EntityDataManager.createKey(EntityElvenSpark.class, DataSerializers.VARINT);
|
||||
|
||||
private final Set<ISparkEntity> transfers = Collections.newSetFromMap(new WeakHashMap<>());
|
||||
|
||||
private int removeTransferants = 2;
|
||||
|
||||
public EntityElvenSpark(World world) {
|
||||
super(world);
|
||||
isImmuneToFire = true;
|
||||
setSize(0.1F, 0.5F);
|
||||
}
|
||||
|
||||
protected void entityInit() {
|
||||
dataManager.register(UPGRADE, 0);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public ItemStack getPickedResult(RayTraceResult target) {
|
||||
return new ItemStack(ItemListAB.itemElvenSpark);
|
||||
}
|
||||
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
if(world.isRemote)
|
||||
return;
|
||||
ISparkAttachable tile = getAttachedTile();
|
||||
if(tile == null) {
|
||||
dropAndKill();
|
||||
return;
|
||||
}
|
||||
SparkUpgradeType upgrade = getUpgrade();
|
||||
List<ISparkEntity> allSparks = null;
|
||||
if(upgrade == SparkUpgradeType.DOMINANT || upgrade == SparkUpgradeType.RECESSIVE)
|
||||
allSparks = SparkHelper.getSparksAround(world, posX, posY + (height / 2.0), posZ);
|
||||
Collection<ISparkEntity> transfers = getTransfers();
|
||||
switch(upgrade) {
|
||||
case DISPERSIVE : {
|
||||
List<EntityPlayer> players = SparkHelper.getEntitiesAround(EntityPlayer.class, world, posX, posY + (height / 2.0), posZ);
|
||||
Map<EntityPlayer, TObjectIntHashMap<ItemStack>> receivingPlayers = new HashMap<>();
|
||||
ItemStack input = new ItemStack(ItemListAB.itemElvenSpark);
|
||||
for(EntityPlayer player : players) {
|
||||
List<ItemStack> stacks = new ArrayList<>();
|
||||
stacks.addAll(player.inventory.mainInventory);
|
||||
stacks.addAll(player.inventory.armorInventory);
|
||||
IItemHandler baubles = BaublesApi.getBaublesHandler(player);
|
||||
for (int i = 0; i < baubles.getSlots(); i++)
|
||||
stacks.add(baubles.getStackInSlot(i));
|
||||
for(ItemStack stack : stacks) {
|
||||
if(stack.isEmpty() || !(stack.getItem() instanceof IManaItem))
|
||||
continue;
|
||||
IManaItem manaItem = (IManaItem) stack.getItem();
|
||||
if(manaItem.canReceiveManaFromItem(stack, input)) {
|
||||
TObjectIntHashMap<ItemStack> receivingStacks;
|
||||
boolean add = false;
|
||||
if(!receivingPlayers.containsKey(player)) {
|
||||
add = true;
|
||||
receivingStacks = new TObjectIntHashMap<>();
|
||||
} else receivingStacks = receivingPlayers.get(player);
|
||||
int recv = Math.min(getAttachedTile().getCurrentMana(), Math.min(TRANSFER_RATE, manaItem.getMaxMana(stack) - manaItem.getMana(stack)));
|
||||
if(recv > 0) {
|
||||
receivingStacks.put(stack, recv);
|
||||
if(add)
|
||||
receivingPlayers.put(player, receivingStacks);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!receivingPlayers.isEmpty()) {
|
||||
List<EntityPlayer> keys = new ArrayList<>(receivingPlayers.keySet());
|
||||
Collections.shuffle(keys);
|
||||
EntityPlayer player = keys.iterator().next();
|
||||
TObjectIntHashMap<ItemStack> items = receivingPlayers.get(player);
|
||||
ItemStack stack = items.keySet().iterator().next();
|
||||
int cost = items.get(stack);
|
||||
int manaToPut = Math.min(getAttachedTile().getCurrentMana(), cost);
|
||||
((IManaItem) stack.getItem()).addMana(stack, manaToPut);
|
||||
getAttachedTile().recieveMana(-manaToPut);
|
||||
particlesTowards(player);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DOMINANT : {
|
||||
List<ISparkEntity> validSparks = new ArrayList<>();
|
||||
for(ISparkEntity spark : allSparks) {
|
||||
if(spark == this)
|
||||
continue;
|
||||
SparkUpgradeType upgrade_ = spark.getUpgrade();
|
||||
if(upgrade_ == SparkUpgradeType.NONE && spark.getAttachedTile() instanceof IManaPool)
|
||||
validSparks.add(spark);
|
||||
}
|
||||
if(validSparks.size() > 0)
|
||||
validSparks.get(world.rand.nextInt(validSparks.size())).registerTransfer(this);
|
||||
break;
|
||||
}
|
||||
case RECESSIVE : {
|
||||
for(ISparkEntity spark : allSparks) {
|
||||
if(spark == this)
|
||||
continue;
|
||||
SparkUpgradeType upgrade_ = spark.getUpgrade();
|
||||
if(upgrade_ != SparkUpgradeType.DOMINANT && upgrade_ != SparkUpgradeType.RECESSIVE && upgrade_ != SparkUpgradeType.ISOLATED)
|
||||
transfers.add(spark);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NONE:
|
||||
default: break;
|
||||
}
|
||||
if(!transfers.isEmpty()) {
|
||||
int manaTotal = Math.min(TRANSFER_RATE * transfers.size(), tile.getCurrentMana());
|
||||
int manaForEach = manaTotal / transfers.size();
|
||||
int manaSpent = 0;
|
||||
if(manaForEach > transfers.size()) {
|
||||
for(ISparkEntity spark : transfers) {
|
||||
if(spark.getAttachedTile() == null || spark.getAttachedTile().isFull() || spark.areIncomingTransfersDone()) {
|
||||
manaTotal -= manaForEach;
|
||||
continue;
|
||||
}
|
||||
ISparkAttachable attached = spark.getAttachedTile();
|
||||
int spend = Math.min(attached.getAvailableSpaceForMana(), manaForEach);
|
||||
attached.recieveMana(spend);
|
||||
manaSpent += spend;
|
||||
particlesTowards((Entity) spark);
|
||||
}
|
||||
tile.recieveMana(-manaSpent);
|
||||
}
|
||||
}
|
||||
if(removeTransferants > 0)
|
||||
removeTransferants--;
|
||||
filterTransfers();
|
||||
}
|
||||
|
||||
private void particlesTowards(Entity e) {
|
||||
PacketHandler.sendToNearby(world, this, new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.SPARK_MANA_FLOW, posX, posY, posZ, getEntityId(), e.getEntityId()));
|
||||
}
|
||||
|
||||
public static void particleBeam(EntityPlayer player, Entity e1, Entity e2) {
|
||||
if(e1 != null && e2 != null && !e1.world.isRemote) {
|
||||
PacketHandler.sendTo((EntityPlayerMP) player, new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.SPARK_NET_INDICATOR, e1.posX, e1.posY, e1.posZ, e1.getEntityId(), e2.getEntityId()));
|
||||
}
|
||||
}
|
||||
|
||||
private void dropAndKill() {
|
||||
SparkUpgradeType upgrade = getUpgrade();
|
||||
entityDropItem(new ItemStack(ItemListAB.itemElvenSpark), 0F);
|
||||
if(upgrade != SparkUpgradeType.NONE)
|
||||
entityDropItem(new ItemStack(ModItems.sparkUpgrade, 1, upgrade.ordinal() - 1), 0F);
|
||||
setDead();
|
||||
}
|
||||
|
||||
public boolean canBeCollidedWith() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean processInitialInteract(EntityPlayer player, EnumHand hand) {
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if(!isDead && !stack.isEmpty()) {
|
||||
if(world.isRemote) {
|
||||
boolean valid = stack.getItem() == ModItems.twigWand || stack.getItem() == ModItems.sparkUpgrade || stack.getItem() == ModItems.phantomInk;
|
||||
if(valid)
|
||||
player.swingArm(hand);
|
||||
return valid;
|
||||
}
|
||||
SparkUpgradeType upgrade = getUpgrade();
|
||||
if(stack.getItem() == ModItems.twigWand) {
|
||||
if(player.isSneaking()) {
|
||||
if(upgrade != SparkUpgradeType.NONE) {
|
||||
entityDropItem(new ItemStack(ModItems.sparkUpgrade, 1, upgrade.ordinal() - 1), 0F);
|
||||
setUpgrade(SparkUpgradeType.NONE);
|
||||
transfers.clear();
|
||||
removeTransferants = 2;
|
||||
} else dropAndKill();
|
||||
return true;
|
||||
} else {
|
||||
for(ISparkEntity spark : SparkHelper.getSparksAround(world, posX, posY + (height / 2.0), posZ))
|
||||
particleBeam(player, this, (Entity) spark);
|
||||
return true;
|
||||
}
|
||||
} else if(stack.getItem() == ModItems.sparkUpgrade && upgrade == SparkUpgradeType.NONE) {
|
||||
int newUpgrade = stack.getItemDamage() + 1;
|
||||
setUpgrade(SparkUpgradeType.values()[newUpgrade]);
|
||||
stack.shrink(1);
|
||||
return true;
|
||||
} else if (stack.getItem() == ModItems.phantomInk) {
|
||||
setInvisible(true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void readEntityFromNBT(@Nonnull NBTTagCompound cmp) {
|
||||
setUpgrade(SparkUpgradeType.values()[cmp.getInteger(TAG_UPGRADE)]);
|
||||
setInvisible(cmp.getInteger(TAG_INVIS) == 1);
|
||||
}
|
||||
|
||||
protected void writeEntityToNBT(@Nonnull NBTTagCompound cmp) {
|
||||
cmp.setInteger(TAG_UPGRADE, getUpgrade().ordinal());
|
||||
cmp.setInteger(TAG_INVIS, isInvisible() ? 1 : 0);
|
||||
}
|
||||
|
||||
public ISparkAttachable getAttachedTile() {
|
||||
int x = MathHelper.floor(posX);
|
||||
int y = MathHelper.floor(posY) - 1;
|
||||
int z = MathHelper.floor(posZ);
|
||||
TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
|
||||
if(tile != null && tile instanceof ISparkAttachable)
|
||||
return (ISparkAttachable) tile;
|
||||
return null;
|
||||
}
|
||||
|
||||
private void filterTransfers() {
|
||||
Iterator<ISparkEntity> iter = transfers.iterator();
|
||||
while (iter.hasNext()) {
|
||||
ISparkEntity spark = iter.next();
|
||||
SparkUpgradeType upgr = getUpgrade();
|
||||
SparkUpgradeType supgr = spark.getUpgrade();
|
||||
ISparkAttachable atile = spark.getAttachedTile();
|
||||
if(!(spark != this
|
||||
&& !spark.areIncomingTransfersDone()
|
||||
&& atile != null && !atile.isFull()
|
||||
&& (upgr == SparkUpgradeType.NONE && supgr == SparkUpgradeType.DOMINANT || upgr == SparkUpgradeType.RECESSIVE && (supgr == SparkUpgradeType.NONE || supgr == SparkUpgradeType.DISPERSIVE) || !(atile instanceof IManaPool))))
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
|
||||
public Collection<ISparkEntity> getTransfers() {
|
||||
filterTransfers();
|
||||
return transfers;
|
||||
}
|
||||
|
||||
private boolean hasTransfer(ISparkEntity entity) {
|
||||
return transfers.contains(entity);
|
||||
}
|
||||
|
||||
public void registerTransfer(ISparkEntity entity) {
|
||||
if(hasTransfer(entity))
|
||||
return;
|
||||
transfers.add(entity);
|
||||
}
|
||||
|
||||
public SparkUpgradeType getUpgrade() {
|
||||
return SparkUpgradeType.values()[dataManager.get(UPGRADE)];
|
||||
}
|
||||
|
||||
public void setUpgrade(SparkUpgradeType upgrade) {
|
||||
dataManager.set(UPGRADE, upgrade.ordinal());
|
||||
}
|
||||
|
||||
public boolean areIncomingTransfersDone() {
|
||||
ISparkAttachable tile = getAttachedTile();
|
||||
if(tile instanceof IManaPool)
|
||||
return removeTransferants > 0;
|
||||
return tile != null && tile.areIncomingTranfersDone();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package pulxes.ab.common.item;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import pulxes.ab.common.entity.EntityElvenSpark;
|
||||
import pulxes.ab.common.lib.LibItemNames;
|
||||
import vazkii.botania.api.internal.VanillaPacketDispatcher;
|
||||
import vazkii.botania.api.mana.IManaGivingItem;
|
||||
import vazkii.botania.api.mana.spark.ISparkAttachable;
|
||||
|
||||
public class ItemElvenSpark extends ItemMod implements IManaGivingItem {
|
||||
|
||||
public ItemElvenSpark() {
|
||||
super(LibItemNames.ELVEN_SPARK);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float xv, float yv, float zv) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile instanceof ISparkAttachable) {
|
||||
ISparkAttachable attach = (ISparkAttachable)tile;
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if(attach.canAttachSpark(stack) && attach.getAttachedSpark() == null) {
|
||||
if(!world.isRemote) {
|
||||
stack.shrink(1);
|
||||
EntityElvenSpark spark = new EntityElvenSpark(world);
|
||||
spark.setPosition(pos.getX() + 0.5D, pos.getY() + 1.5D, pos.getZ() + 0.5D);
|
||||
world.spawnEntity(spark);
|
||||
attach.attachSpark(spark);
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(world, pos);
|
||||
}
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
return EnumActionResult.PASS;
|
||||
}
|
||||
}
|
||||
@@ -16,13 +16,13 @@ public class ItemMod extends Item implements IModelRegister {
|
||||
|
||||
public ItemMod(String name) {
|
||||
this.setCreativeTab(AdvancedBotany.tabAB);
|
||||
this.setRegistryName(new ResourceLocation("ab", name));
|
||||
this.setRegistryName(new ResourceLocation(AdvancedBotany.MODID, name));
|
||||
this.setUnlocalizedName(name);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public String getUnlocalizedNameInefficiently(@Nonnull ItemStack stack) {
|
||||
return super.getUnlocalizedNameInefficiently(stack).replaceAll("item\\.", "item.ab:");
|
||||
return super.getUnlocalizedNameInefficiently(stack).replaceAll("item\\.", "item." + AdvancedBotany.MODID + ":");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@@ -20,6 +20,7 @@ import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import pulxes.ab.AdvancedBotany;
|
||||
import pulxes.ab.common.lib.LibItemNames;
|
||||
import vazkii.botania.api.recipe.IFlowerComponent;
|
||||
|
||||
@@ -50,7 +51,7 @@ public class ItemResource extends ItemMod implements IFlowerComponent {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerModels() {
|
||||
for(int i = 0; i < LibItemNames.RESOURCE_NAMES.length; i++)
|
||||
ModelLoader.setCustomModelResourceLocation(this, i, new ModelResourceLocation("ab:" + LibItemNames.RESOURCE_NAMES[i], "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(this, i, new ModelResourceLocation(AdvancedBotany.MODID + ":" + LibItemNames.RESOURCE_NAMES[i], "inventory"));
|
||||
}
|
||||
|
||||
public int getParticleColor(ItemStack stack) {
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package pulxes.ab.common.item.block;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import pulxes.ab.AdvancedBotany;
|
||||
|
||||
public class ItemBlockMod extends ItemBlock {
|
||||
|
||||
public ItemBlockMod(Block block) {
|
||||
super(block);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public String getUnlocalizedNameInefficiently(@Nonnull ItemStack par1ItemStack) {
|
||||
return getUnlocalizedNameInefficiently_(par1ItemStack).replaceAll("tile.", "tile." + AdvancedBotany.MODID + ":");
|
||||
}
|
||||
|
||||
public String getUnlocalizedNameInefficiently_(ItemStack stack) {
|
||||
return super.getUnlocalizedNameInefficiently(stack);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,394 @@
|
||||
package pulxes.ab.common.item.equipment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import pulxes.ab.AdvancedBotany;
|
||||
import pulxes.ab.common.item.ItemMod;
|
||||
import pulxes.ab.common.lib.LibItemNames;
|
||||
import vazkii.botania.api.item.IBlockProvider;
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
import vazkii.botania.common.core.helper.PlayerHelper;
|
||||
import vazkii.botania.common.item.ItemBlackHoleTalisman;
|
||||
import vazkii.botania.common.item.ItemCraftingHalo;
|
||||
|
||||
public class ItemBlackHoleBox extends ItemMod implements IBlockProvider {
|
||||
|
||||
public static final ResourceLocation GLOW_TEXTURE = new ResourceLocation(AdvancedBotany.MODID + ":textures/misc/glow.png");
|
||||
private static final int MAX_SEGMENTS = 12;
|
||||
|
||||
public ItemBlackHoleBox() {
|
||||
super(LibItemNames.BLACK_HOLE_BOX);
|
||||
this.setMaxStackSize(1);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public void onUpdate(@Nonnull ItemStack stack, World world, @Nonnull Entity entity, int pos, boolean equipped) {
|
||||
if(!(entity instanceof EntityLivingBase))
|
||||
return;
|
||||
EntityLivingBase living = (EntityLivingBase)entity;
|
||||
boolean eqLastTick = wasEquipped(stack);
|
||||
if(!equipped && living.getHeldItemOffhand() == stack)
|
||||
equipped = true;
|
||||
if(!equipped && eqLastTick)
|
||||
setEquipped(stack, equipped);
|
||||
if(!eqLastTick && equipped) {
|
||||
setEquipped(stack, equipped);
|
||||
int angles = 360;
|
||||
int segAngles = angles / MAX_SEGMENTS;
|
||||
float shift = (segAngles / 2);
|
||||
setRotationBase(stack, getCheckingAngle((EntityLivingBase)entity) - shift);
|
||||
}
|
||||
if(!world.isRemote && entity.ticksExisted % 10 == 0) {
|
||||
for(int i = 0; i < MAX_SEGMENTS; i++) {
|
||||
ItemStack blackHalo = getItemForSlot(stack, i).copy();
|
||||
if(!blackHalo.isEmpty()) {
|
||||
((ItemBlackHoleTalisman)blackHalo.getItem()).onUpdate(blackHalo, world, entity, pos, equipped);
|
||||
setItemSlot(stack, blackHalo, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) {
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
int segment = getSegmentLookedAt(stack, player);
|
||||
if(!getItemForSlot(stack, segment).isEmpty()) {
|
||||
ItemStack blackHole = getItemForSlot(stack, segment).copy();
|
||||
if(player.isSneaking()) {
|
||||
ItemHandlerHelper.giveItemToPlayer(player, blackHole);
|
||||
setItemSlot(stack, ItemStack.EMPTY, segment);
|
||||
return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
|
||||
} else {
|
||||
int dmg = blackHole.getItemDamage();
|
||||
blackHole.setItemDamage((dmg ^ 0xFFFFFFFF) & 0x1);
|
||||
player.playSound(SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, 0.3F, 0.1F);
|
||||
setItemSlot(stack, blackHole, segment);
|
||||
return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
|
||||
}
|
||||
} else {
|
||||
for(int i = 0; i < 9; i++) {
|
||||
ItemStack hotBarStack = player.inventory.getStackInSlot(i);
|
||||
if(!hotBarStack.isEmpty() && hotBarStack.getItem() instanceof ItemBlackHoleTalisman) {
|
||||
Block block = ((ItemBlackHoleTalisman)hotBarStack.getItem()).getBlock(hotBarStack);
|
||||
if(block != null && Item.getItemFromBlock(block) != Items.AIR) {
|
||||
setItemSlot(stack, hotBarStack, segment);
|
||||
hotBarStack.shrink(1);
|
||||
return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
ItemStack box = player.getHeldItem(hand);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile != null && tile.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side)) {
|
||||
if(!world.isRemote) {
|
||||
for(int i = 0; i < MAX_SEGMENTS; i++) {
|
||||
ItemStack blackHole = getItemForSlot(box, i).copy();
|
||||
if(blackHole.isEmpty())
|
||||
continue;
|
||||
ItemBlackHoleTalisman blackHoleItem = (ItemBlackHoleTalisman)blackHole.getItem();
|
||||
Block bBlock = blackHoleItem.getBlock(blackHole);
|
||||
int bmeta = blackHoleItem.getBlockMeta(blackHole);
|
||||
IItemHandler inv = (IItemHandler)tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side);
|
||||
ItemStack toAdd = new ItemStack(bBlock, 1, bmeta);
|
||||
toAdd.setCount(blackHoleItem.remove(blackHole, toAdd.getMaxStackSize()));
|
||||
ItemStack remainder = ItemHandlerHelper.insertItemStacked(inv, toAdd, false);
|
||||
if(!remainder.isEmpty())
|
||||
ItemNBTHelper.setInt(blackHole, "blockCount", blackHoleItem.getBlockCount(blackHole) + remainder.getCount());
|
||||
setItemSlot(box, blackHole, i);
|
||||
}
|
||||
}
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
return EnumActionResult.PASS;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack box, World world, List<String> list, ITooltipFlag flags) {
|
||||
if(GuiScreen.isShiftKeyDown()) {
|
||||
for(int i = 0; i < MAX_SEGMENTS; i++) {
|
||||
ItemStack blackHole = getItemForSlot(box, i).copy();
|
||||
if(blackHole.isEmpty())
|
||||
continue;
|
||||
ItemBlackHoleTalisman talisman = (ItemBlackHoleTalisman)blackHole.getItem();
|
||||
Block block = talisman.getBlock(blackHole);
|
||||
int count = talisman.getBlockCount(blackHole);
|
||||
String active = "" + (blackHole.getItemDamage() == 1 ? TextFormatting.GREEN : TextFormatting.RED);
|
||||
list.add(active + count + TextFormatting.RESET + " " + I18n.format((new ItemStack(block, 1, talisman.getBlockMeta(blackHole))).getUnlocalizedName() + ".name", new Object[0]));
|
||||
}
|
||||
} else
|
||||
list.add(I18n.format("botaniamisc.shiftinfo", new Object[0]).replaceAll("&", "\u00A7"));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void onRenderWorldLast(RenderWorldLastEvent event) {
|
||||
EntityPlayerSP entityPlayerSP = (Minecraft.getMinecraft()).player;
|
||||
ItemStack stack = PlayerHelper.getFirstHeldItemClass((EntityPlayer)entityPlayerSP, ItemBlackHoleBox.class);
|
||||
boolean hasCraftingHalo = (entityPlayerSP.getHeldItemMainhand().getItem() instanceof ItemCraftingHalo) || (entityPlayerSP.getHeldItemOffhand().getItem() instanceof ItemCraftingHalo);
|
||||
if(!stack.isEmpty() && !hasCraftingHalo)
|
||||
render(stack, (EntityPlayer)entityPlayerSP, event.getPartialTicks());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void render(ItemStack stack, EntityPlayer player, float partialTicks) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Tessellator tess = Tessellator.getInstance();
|
||||
double renderPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks;
|
||||
double renderPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks;
|
||||
double renderPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks;
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(770, 771);
|
||||
float alpha = ((float)Math.sin(((ClientTickHandler.ticksInGame + partialTicks) * 0.2F)) * 0.5F + 0.5F) * 0.4F + 0.3F;
|
||||
double posX = player.prevPosX + (player.posX - player.prevPosX) * partialTicks;
|
||||
double posY = player.prevPosY + (player.posY - player.prevPosY) * partialTicks;
|
||||
double posZ = player.prevPosZ + (player.posZ - player.prevPosZ) * partialTicks;
|
||||
GlStateManager.translate(posX - renderPosX, posY - renderPosY + player.getDefaultEyeHeight(), posZ - renderPosZ);
|
||||
float base = getRotationBase(stack);
|
||||
int angles = 360;
|
||||
int segAngles = angles / MAX_SEGMENTS;
|
||||
float shift = base - (segAngles / 2);
|
||||
float u = 1.0F;
|
||||
float v = 0.25F;
|
||||
float s = 3.2F;
|
||||
float m = 0.8F;
|
||||
float y = v * s * 2.0F;
|
||||
float y0 = 0.0F;
|
||||
int segmentLookedAt = getSegmentLookedAt(stack, (EntityLivingBase)player);
|
||||
for(int seg = 0; seg < MAX_SEGMENTS; seg++) {
|
||||
boolean inside = false;
|
||||
float rotationAngle = (seg + 0.5F) * segAngles + shift;
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.rotate(rotationAngle, 0.0F, 1.0F, 0.0F);
|
||||
GlStateManager.translate(s * m, -0.75F, 0.0F);
|
||||
if(segmentLookedAt == seg)
|
||||
inside = true;
|
||||
ItemStack slotStack = getItemForSlot(stack, seg);
|
||||
if(!slotStack.isEmpty()) {
|
||||
ItemBlackHoleTalisman blackHole = (ItemBlackHoleTalisman)slotStack.getItem();
|
||||
ItemStack renderStack = new ItemStack(blackHole.getBlock(slotStack));
|
||||
int meta = 0;
|
||||
if(renderStack.getItem().getHasSubtypes())
|
||||
meta = blackHole.getBlockMeta(slotStack);
|
||||
renderStack.setItemDamage(meta);
|
||||
mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
float scale = 0.75F;
|
||||
double worldTime = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks + seg * 2.75f;
|
||||
GlStateManager.scale(scale, scale, scale);
|
||||
GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
|
||||
GlStateManager.translate(0.0F, 0.4F + Math.sin(worldTime / 8.0D) / 20.0D, 0.0F);
|
||||
GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F);
|
||||
Minecraft.getMinecraft().getRenderItem().renderItem(renderStack, ItemCameraTransforms.TransformType.GUI);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
}
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F);
|
||||
float a = alpha;
|
||||
if(inside) {
|
||||
a += 0.3F;
|
||||
y0 = -y;
|
||||
}
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(770, 771);
|
||||
if(seg % 2 == 0)
|
||||
GlStateManager.color(0.6F, 0.6F, 0.6F, a);
|
||||
else
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, a);
|
||||
GlStateManager.disableCull();
|
||||
mc.renderEngine.bindTexture(GLOW_TEXTURE);
|
||||
tess.getBuffer().begin(7, DefaultVertexFormats.POSITION_TEX);
|
||||
for(int i = 0; i < segAngles; i++) {
|
||||
float ang = (i + seg * segAngles) + shift;
|
||||
double xp = Math.cos(ang * Math.PI / 180.0D) * s;
|
||||
double zp = Math.sin(ang * Math.PI / 180.0D) * s;
|
||||
tess.getBuffer().pos(xp * m, y, zp * m).tex(u, v).endVertex();
|
||||
tess.getBuffer().pos(xp, y0, zp).tex(u, 0.0D).endVertex();
|
||||
xp = Math.cos((ang + 1.0F) * Math.PI / 180.0D) * s;
|
||||
zp = Math.sin((ang + 1.0F) * Math.PI / 180.0D) * s;
|
||||
tess.getBuffer().pos(xp, y0, zp).tex(0.0D, 0.0D).endVertex();
|
||||
tess.getBuffer().pos(xp * m, y, zp * m).tex(0.0D, v).endVertex();
|
||||
}
|
||||
y0 = 0.0F;
|
||||
tess.draw();
|
||||
GlStateManager.enableCull();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void renderHUD(ScaledResolution resolution, EntityPlayer player, ItemStack box) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
int slot = getSegmentLookedAt(box, player);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(770, 771);
|
||||
ItemStack blackHole = getItemForSlot(box, slot);
|
||||
if(!blackHole.isEmpty()) {
|
||||
String name = blackHole.getDisplayName();
|
||||
String count = "" + ((ItemBlackHoleTalisman)blackHole.getItem()).getBlockCount(blackHole);
|
||||
int l = mc.fontRenderer.getStringWidth(name);
|
||||
int x = resolution.getScaledWidth() / 2 - l / 2;
|
||||
int y = resolution.getScaledHeight() / 2 - 65;
|
||||
Gui.drawRect(x - 6, y - 6, x + l + 6, y + 43, 570425344);
|
||||
Gui.drawRect(x - 4, y - 4, x + l + 4, y + 41, 570425344);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GlStateManager.enableRescaleNormal();
|
||||
mc.getRenderItem().renderItemAndEffectIntoGUI(blackHole, resolution.getScaledWidth() / 2 - 8, resolution.getScaledHeight() / 2 - 52);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
mc.fontRenderer.drawStringWithShadow(name, x, y, 16777215);
|
||||
mc.fontRenderer.drawStringWithShadow(count, resolution.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(count) / 2, y + 32, 16777215);
|
||||
}
|
||||
}
|
||||
|
||||
public void setItemSlot(ItemStack box, ItemStack stack, int slot) {
|
||||
NBTTagCompound cmp = new NBTTagCompound();
|
||||
if(!stack.isEmpty())
|
||||
stack.copy().writeToNBT(cmp);
|
||||
ItemNBTHelper.setCompound(box, "blackHoleSlot" + slot, cmp);
|
||||
}
|
||||
|
||||
public static ItemStack getItemForSlot(ItemStack box, int slot) {
|
||||
if(slot >= MAX_SEGMENTS)
|
||||
return ItemStack.EMPTY;
|
||||
NBTTagCompound cmp = ItemNBTHelper.getCompound(box, "blackHoleSlot" + slot, true);
|
||||
if(cmp != null)
|
||||
return new ItemStack(cmp);
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
private static int getSegmentLookedAt(ItemStack stack, EntityLivingBase player) {
|
||||
getRotationBase(stack);
|
||||
float yaw = getCheckingAngle(player, getRotationBase(stack));
|
||||
int angles = 360;
|
||||
int segAngles = angles / MAX_SEGMENTS;
|
||||
for (int seg = 0; seg < MAX_SEGMENTS; seg++) {
|
||||
float calcAngle = seg * segAngles;
|
||||
if (yaw >= calcAngle && yaw < calcAngle + segAngles)
|
||||
return seg;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static void setRotationBase(ItemStack stack, float rotation) {
|
||||
ItemNBTHelper.setFloat(stack, "rotationBase", rotation);
|
||||
}
|
||||
|
||||
public static float getRotationBase(ItemStack stack) {
|
||||
return ItemNBTHelper.getFloat(stack, "rotationBase", 0.0F);
|
||||
}
|
||||
|
||||
private static float getCheckingAngle(EntityLivingBase player, float base) {
|
||||
float yaw = MathHelper.wrapDegrees(player.rotationYaw) + 90.0F;
|
||||
int angles = 360;
|
||||
int segAngles = angles / MAX_SEGMENTS;
|
||||
float shift = (segAngles / 2);
|
||||
if (yaw < 0.0F)
|
||||
yaw = 180.0F + 180.0F + yaw;
|
||||
yaw -= 360.0F - base;
|
||||
float angle = 360.0F - yaw + shift;
|
||||
if (angle < 0.0F)
|
||||
angle = 360.0F + angle;
|
||||
return angle;
|
||||
}
|
||||
|
||||
private static float getCheckingAngle(EntityLivingBase player) {
|
||||
return getCheckingAngle(player, 0.0F);
|
||||
}
|
||||
|
||||
public static void setEquipped(ItemStack stack, boolean equipped) {
|
||||
ItemNBTHelper.setBoolean(stack, "equipped", equipped);
|
||||
}
|
||||
|
||||
public static boolean wasEquipped(ItemStack stack) {
|
||||
return ItemNBTHelper.getBoolean(stack, "equipped", false);
|
||||
}
|
||||
|
||||
public int getBlockCount(EntityPlayer player, ItemStack requestor, ItemStack box, Block block, int meta) {
|
||||
for(int i = 0; i < MAX_SEGMENTS; i++) {
|
||||
ItemStack blackHole = getItemForSlot(box, i).copy();
|
||||
if(blackHole.isEmpty())
|
||||
continue;
|
||||
ItemBlackHoleTalisman talisman = (ItemBlackHoleTalisman)blackHole.getItem();
|
||||
Block stored = talisman.getBlock(blackHole);
|
||||
int storedMeta = talisman.getBlockMeta(blackHole);
|
||||
if(stored == block && storedMeta == meta)
|
||||
return talisman.getBlockCount(blackHole);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean provideBlock(EntityPlayer player, ItemStack requestor, ItemStack box, Block block, int meta, boolean doit) {
|
||||
for(int i = 0; i < MAX_SEGMENTS; i++) {
|
||||
ItemStack blackHole = getItemForSlot(box, i).copy();
|
||||
if(blackHole.isEmpty())
|
||||
continue;
|
||||
ItemBlackHoleTalisman talisman = (ItemBlackHoleTalisman)blackHole.getItem();
|
||||
Block stored = talisman.getBlock(blackHole);
|
||||
int storedMeta = talisman.getBlockMeta(blackHole);
|
||||
if(stored == block && storedMeta == meta) {
|
||||
int count = talisman.getBlockCount(blackHole);
|
||||
if(count > 0) {
|
||||
if(doit) {
|
||||
talisman.remove(blackHole, 1);
|
||||
setItemSlot(box, blackHole, i);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
@@ -45,7 +46,9 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import pulxes.ab.AdvancedBotany;
|
||||
import pulxes.ab.api.AdvancedBotanyAPI;
|
||||
import pulxes.ab.api.EffectRender;
|
||||
import pulxes.ab.api.IRankItem;
|
||||
import pulxes.ab.client.core.handler.ClientEffectHandler;
|
||||
import pulxes.ab.common.core.handler.AdvBotanyConfigHandler;
|
||||
import pulxes.ab.common.core.handler.NetworkHandler;
|
||||
import pulxes.ab.common.entity.EntityProjectileSpaceBurst;
|
||||
@@ -67,10 +70,10 @@ public class ItemSpaceBlade extends ItemSword implements IModelRegister, IRankIt
|
||||
public ItemSpaceBlade() {
|
||||
super(AdvancedBotanyAPI.MITHRILL_TOOL_MATERIAL);
|
||||
this.setCreativeTab(AdvancedBotany.tabAB);
|
||||
this.setRegistryName(new ResourceLocation("ab", LibItemNames.SPACE_BLADE));
|
||||
this.setRegistryName(new ResourceLocation(AdvancedBotany.MODID, LibItemNames.SPACE_BLADE));
|
||||
this.setUnlocalizedName(LibItemNames.SPACE_BLADE);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
this.addPropertyOverride(new ResourceLocation("ab", "enabled"), (stack, world, entity) -> isEnabledMode(stack) ? 1.0F : 0.0F);
|
||||
this.addPropertyOverride(new ResourceLocation(AdvancedBotany.MODID, "enabled"), (stack, world, entity) -> isEnabledMode(stack) ? 1.0F : 0.0F);
|
||||
}
|
||||
|
||||
public boolean hitEntity(ItemStack stack, EntityLivingBase entity, @Nonnull EntityLivingBase attacker) {
|
||||
@@ -100,15 +103,6 @@ public class ItemSpaceBlade extends ItemSword implements IModelRegister, IRankIt
|
||||
if(!world.isRemote) {
|
||||
if(rechargeTick > 0)
|
||||
setRechargeTick(stack, --rechargeTick);
|
||||
} else {
|
||||
if(rechargeTick > 24 && (player.getHeldItemMainhand() == stack || player.getHeldItemOffhand() == stack)) {
|
||||
for(int i = 0; i < 16; i++) {
|
||||
float r = world.rand.nextBoolean() ? (225.0f / 255.0f) : (101.0f / 255.0f);
|
||||
float g = world.rand.nextBoolean() ? (67.0f / 255.0f) : (209.0f / 255.0f);
|
||||
float b = world.rand.nextBoolean() ? (240.0f / 255.0f) : (225.0f / 255.0f);
|
||||
Botania.proxy.sparkleFX(entity.posX + (Math.random() - 0.5D), entity.posY + ((Math.random() - 0.5D) * 2) + 1.0f, entity.posZ + (Math.random() - 0.5D), r + (float)(Math.random() / 4 - 0.125D), g + (float)(Math.random() / 4 - 0.125D), b + (float)(Math.random() / 4 - 0.125D), 1.8F * (float)(Math.random() - 0.5D), 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -177,6 +171,21 @@ public class ItemSpaceBlade extends ItemSword implements IModelRegister, IRankIt
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void doParticleDash() {
|
||||
EffectRender effectRender = new EffectRender(7) {
|
||||
public void doEffect() {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
for(int i = 0; i < 16; i++) {
|
||||
float r = mc.world.rand.nextBoolean() ? (225.0f / 255.0f) : (101.0f / 255.0f);
|
||||
float g = mc.world.rand.nextBoolean() ? (67.0f / 255.0f) : (209.0f / 255.0f);
|
||||
float b = mc.world.rand.nextBoolean() ? (240.0f / 255.0f) : (225.0f / 255.0f);
|
||||
Botania.proxy.sparkleFX(mc.player.posX + (Math.random() - 0.5D), mc.player.posY + ((Math.random() - 0.5D) * 2) + 1.0f, mc.player.posZ + (Math.random() - 0.5D), r + (float)(Math.random() / 4 - 0.125D), g + (float)(Math.random() / 4 - 0.125D), b + (float)(Math.random() / 4 - 0.125D), 1.8F * (float)(Math.random() - 0.5D), 4);
|
||||
}
|
||||
}
|
||||
};
|
||||
ClientEffectHandler.addEffectRender(effectRender);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static void playerSpaceDash(@Nonnull EntityPlayer player) {
|
||||
Vec3d vec3 = player.getLook(1.0F).normalize();
|
||||
@@ -212,7 +221,7 @@ public class ItemSpaceBlade extends ItemSword implements IModelRegister, IRankIt
|
||||
|
||||
@Nonnull
|
||||
public String getUnlocalizedNameInefficiently(@Nonnull ItemStack stack) {
|
||||
return super.getUnlocalizedNameInefficiently(stack).replaceAll("item\\.", "item.ab:");
|
||||
return super.getUnlocalizedNameInefficiently(stack).replaceAll("item\\.", "item." + AdvancedBotany.MODID + ":");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package pulxes.ab.common.lib;
|
||||
|
||||
public class LibBlockNames {
|
||||
|
||||
public static final String NIDAVELLIR_FORGE = "nidavellir_forge";
|
||||
|
||||
}
|
||||
@@ -1,12 +1,15 @@
|
||||
package pulxes.ab.common.lib;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import pulxes.ab.AdvancedBotany;
|
||||
|
||||
public class LibEntityNames {
|
||||
|
||||
public static final ResourceLocation SPACE_BURST_REGISTRY = makeName("space_burst");
|
||||
public static final ResourceLocation ALPHIRINE_PORTAL_REGISTRY = makeName("alphirine_portal");
|
||||
public static final ResourceLocation ELVEN_SPARK_REGISTRY = makeName("elven_spark");
|
||||
|
||||
private static ResourceLocation makeName(String str) {
|
||||
return new ResourceLocation("ab", str);
|
||||
return new ResourceLocation(AdvancedBotany.MODID, str);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,10 @@ public class LibItemNames {
|
||||
public static final String NEBULA_ROD = "nebula_rod";
|
||||
|
||||
public static final String SPACE_BLADE = "space_blade";
|
||||
|
||||
public static final String BLACK_HOLE_BOX = "black_hole_box";
|
||||
|
||||
public static final String ELVEN_SPARK = "elven_spark";
|
||||
|
||||
public static final String[] RESOURCE_NAMES = new String[] {
|
||||
"mithrill", "mithrill_nugget", "mana_nether_star", "air_forgotten_lands", "nature_gift",
|
||||
|
||||
@@ -1,5 +1,42 @@
|
||||
package pulxes.ab.common.lib.register;
|
||||
|
||||
public class BlockListAB {
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import pulxes.ab.AdvancedBotany;
|
||||
import pulxes.ab.common.block.BlockNidavellirForge;
|
||||
import pulxes.ab.common.block.tile.TileNidavellirForge;
|
||||
import pulxes.ab.common.item.block.ItemBlockMod;
|
||||
import pulxes.ab.common.lib.LibBlockNames;
|
||||
|
||||
}
|
||||
@EventBusSubscriber(modid = AdvancedBotany.MODID)
|
||||
public class BlockListAB {
|
||||
|
||||
public static final Block nidavellirForge = new BlockNidavellirForge();
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerBlocks(RegistryEvent.Register<Block> evt) {
|
||||
IForgeRegistry<Block> r = evt.getRegistry();
|
||||
r.register(nidavellirForge);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerItemBlocks(RegistryEvent.Register<Item> evt) {
|
||||
IForgeRegistry<Item> r = evt.getRegistry();
|
||||
r.register((new ItemBlockMod(nidavellirForge)).setRegistryName(nidavellirForge.getRegistryName()));
|
||||
initTileEntities();
|
||||
}
|
||||
|
||||
private static void initTileEntities() {
|
||||
registerTile(TileNidavellirForge.class, LibBlockNames.NIDAVELLIR_FORGE);
|
||||
}
|
||||
|
||||
private static void registerTile(Class<? extends TileEntity> clazz, String key) {
|
||||
GameRegistry.registerTileEntity(clazz, AdvancedBotany.MODID + ":" + key);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,8 @@ package pulxes.ab.common.lib.register;
|
||||
|
||||
import net.minecraftforge.fml.common.registry.EntityRegistry;
|
||||
import pulxes.ab.AdvancedBotany;
|
||||
import pulxes.ab.common.entity.EntityAlphirinePortal;
|
||||
import pulxes.ab.common.entity.EntityElvenSpark;
|
||||
import pulxes.ab.common.entity.EntityProjectileSpaceBurst;
|
||||
import pulxes.ab.common.lib.LibEntityNames;
|
||||
|
||||
@@ -9,6 +11,8 @@ public class EntityListAB {
|
||||
|
||||
public static void init() {
|
||||
int id = 0;
|
||||
EntityRegistry.registerModEntity(LibEntityNames.SPACE_BURST_REGISTRY, EntityProjectileSpaceBurst.class, "ab:spaceBurst", id++, AdvancedBotany.instance, 64, 10, true);
|
||||
EntityRegistry.registerModEntity(LibEntityNames.SPACE_BURST_REGISTRY, EntityProjectileSpaceBurst.class, AdvancedBotany.MODID + ":spaceBurst", id++, AdvancedBotany.instance, 64, 10, true);
|
||||
EntityRegistry.registerModEntity(LibEntityNames.ALPHIRINE_PORTAL_REGISTRY, EntityAlphirinePortal.class, AdvancedBotany.MODID + ":alphirinePortal", id++, AdvancedBotany.instance, 64, 10, true);
|
||||
EntityRegistry.registerModEntity(LibEntityNames.ELVEN_SPARK_REGISTRY, EntityElvenSpark.class, AdvancedBotany.MODID + ":elvenSpark", id++, AdvancedBotany.instance, 64, 10, true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package pulxes.ab.common.lib.register;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import pulxes.ab.common.block.subtile.SubTileAncientAlphirine;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.BotaniaAPIClient;
|
||||
import vazkii.botania.api.subtile.SubTileEntity;
|
||||
import vazkii.botania.api.subtile.signature.BasicSignature;
|
||||
|
||||
public class FlowerListAB {
|
||||
|
||||
public static final String ANCIENT_ALPHIRINE = "ancient_alphirine";
|
||||
|
||||
public static void init() {
|
||||
registerFlower(SubTileAncientAlphirine.class, ANCIENT_ALPHIRINE);
|
||||
}
|
||||
|
||||
static void registerFlower(Class <? extends SubTileEntity> subTile, String name) {
|
||||
BotaniaAPI.registerSubTile(name, subTile);
|
||||
BotaniaAPI.registerSubTileSignature(subTile, new BasicSignature(name));
|
||||
BotaniaAPI.addSubTileToCreativeMenu(name);
|
||||
BotaniaAPIClient.registerSubtileModel(subTile, new ModelResourceLocation("botania:" + name));
|
||||
}
|
||||
}
|
||||
@@ -12,9 +12,11 @@ import pulxes.ab.common.item.equipment.*;
|
||||
@EventBusSubscriber(modid = AdvancedBotany.MODID)
|
||||
public class ItemListAB {
|
||||
|
||||
public static Item itemResource = new ItemResource();
|
||||
public static Item itemNebulaRod = new ItemNebulaRod();
|
||||
public static Item itemSpaceBlade = new ItemSpaceBlade();
|
||||
public static final Item itemResource = new ItemResource();
|
||||
public static final Item itemNebulaRod = new ItemNebulaRod();
|
||||
public static final Item itemSpaceBlade = new ItemSpaceBlade();
|
||||
public static final Item itemBlackHoleBox = new ItemBlackHoleBox();
|
||||
public static final Item itemElvenSpark = new ItemElvenSpark();
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerItems(RegistryEvent.Register<Item> evt) {
|
||||
@@ -22,5 +24,7 @@ public class ItemListAB {
|
||||
r.register(itemResource);
|
||||
r.register(itemNebulaRod);
|
||||
r.register(itemSpaceBlade);
|
||||
r.register(itemBlackHoleBox);
|
||||
r.register(itemElvenSpark);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,28 @@
|
||||
package pulxes.ab.common.lib.register;
|
||||
|
||||
public class RecipeListAB {
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import pulxes.ab.api.AdvancedBotanyAPI;
|
||||
import pulxes.ab.api.recipe.RecipeAncientAlphirine;
|
||||
import pulxes.ab.api.recipe.RecipeNidavellirForge;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
|
||||
public class RecipeListAB {
|
||||
|
||||
public static RecipeAncientAlphirine forgottenLandRecipe;
|
||||
|
||||
public static RecipeNidavellirForge mithrillRecipe;
|
||||
public static RecipeNidavellirForge terrasteelRecipe;
|
||||
public static RecipeNidavellirForge manaStarRecipe;
|
||||
public static RecipeNidavellirForge nebulaRecipe;
|
||||
|
||||
public static void init() {
|
||||
forgottenLandRecipe = AdvancedBotanyAPI.registerAlphirineRecipe(new ItemStack(ItemListAB.itemResource, 1, 3), new ItemStack(ModItems.manaResource, 1, 15), 75);
|
||||
|
||||
mithrillRecipe = AdvancedBotanyAPI.registerForgeRecipe(new ItemStack(ItemListAB.itemResource, 1, 0), new ItemStack(ModItems.manaResource, 1, 5), new ItemStack(ModBlocks.storage, 1, 0), new ItemStack(ModItems.manaResource, 1, 18), 2500000, 0x25d6b7);
|
||||
terrasteelRecipe = AdvancedBotanyAPI.registerForgeRecipe(new ItemStack(ModItems.manaResource, 1, 4), new ItemStack(ModItems.manaResource, 1, 2), new ItemStack(ModItems.manaResource, 1, 0), new ItemStack(ModItems.manaResource, 1, 1), 500000, 0x29de20);
|
||||
manaStarRecipe = AdvancedBotanyAPI.registerForgeRecipe(new ItemStack(ItemListAB.itemResource, 1, 2), new ItemStack(ModItems.manaResource, 1, 23), new ItemStack(ModItems.manaResource, 1, 5), new ItemStack(Items.NETHER_STAR), 250000, 0x6bc9ec);
|
||||
nebulaRecipe = AdvancedBotanyAPI.registerForgeRecipe(new ItemStack(ItemListAB.itemResource, 1, 5), new ItemStack(ModItems.manaResource, 1, 8), new ItemStack(ModBlocks.storage, 1, 4), new ItemStack(ItemListAB.itemResource, 1, 1), 25000000, 0x8d16e0);
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ public class SoundListAB {
|
||||
public static final SoundEvent bladeSpace = makeSoundEvent("bladespace");
|
||||
|
||||
private static SoundEvent makeSoundEvent(String name) {
|
||||
ResourceLocation loc = new ResourceLocation("ab", name);
|
||||
ResourceLocation loc = new ResourceLocation(AdvancedBotany.MODID, name);
|
||||
return (new SoundEvent(loc)).setRegistryName(loc);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package pulxes.ab.common.lib.register.lexicon;
|
||||
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import pulxes.ab.common.lib.register.FlowerListAB;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.KnowledgeType;
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconPage;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
import vazkii.botania.common.lexicon.BLexiconCategory;
|
||||
import vazkii.botania.common.lexicon.BasicLexiconEntry;
|
||||
import vazkii.botania.common.lexicon.page.PageText;
|
||||
|
||||
public class LexiconListAB {
|
||||
|
||||
public static final LexiconCategory CATEGORY_FORGOTTEN;
|
||||
public static final KnowledgeType KNOWLEDGE_FORGOTTEN;
|
||||
|
||||
public static LexiconEntry ancientAlphirine;
|
||||
|
||||
public static void init() {
|
||||
ancientAlphirine = new BasicLexiconEntry("ancientAlphirine", CATEGORY_FORGOTTEN);
|
||||
ancientAlphirine.setPriority().setKnowledgeType(BotaniaAPI.elvenKnowledge).setLexiconPages(new LexiconPage[] { new PageText("0") }).setIcon(ItemBlockSpecialFlower.ofType(FlowerListAB.ANCIENT_ALPHIRINE));
|
||||
}
|
||||
|
||||
static {
|
||||
BotaniaAPI.addCategory(CATEGORY_FORGOTTEN = new BLexiconCategory("forgotten", 5));
|
||||
KNOWLEDGE_FORGOTTEN = BotaniaAPI.registerKnowledgeType("forgotten", TextFormatting.BLUE, false);
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"parent": "minecraft:item/handheld",
|
||||
"textures": {
|
||||
"layer0": "ab:items/space_blade",
|
||||
"layer1": "ab:items/space_blade_overlay"
|
||||
},
|
||||
"overrides": [{
|
||||
"predicate": {
|
||||
"ab:enabled": 1
|
||||
},
|
||||
"model": "ab:item/space_blade_enabled"
|
||||
}]
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"parent": "minecraft:item/handheld",
|
||||
"textures": {
|
||||
"layer0": "ab:items/space_blade_enabled",
|
||||
"layer1": "ab:items/space_blade_overlay"
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"boardcube": { "sounds":["ab:boardcube"], "subtitle": "ab.subtitle.boardcube" },
|
||||
"nebulablaze": { "sounds":["ab:nebulablaze"], "subtitle": "ab.subtitle.nebulablaze" },
|
||||
"bladespace": { "sounds":["ab:bladespace"], "subtitle": "ab.subtitle.bladespace" },
|
||||
"nebularod": { "sounds":["ab:nebularod"], "subtitle": "ab.subtitle.nebularod" },
|
||||
"hornplentyusing": { "sounds":["ab:hornplentyusing"], "subtitle": "ab.subtitle.hornplentyusing" },
|
||||
"freyrslingshot": { "sounds":["ab:freyrslingshot"], "subtitle": "ab.subtitle.freyrslingshot" },
|
||||
"lokicubearmor": { "sounds":["ab:lokicubearmor"], "subtitle": "ab.subtitle.lokicubearmor" }
|
||||
}
|
||||
|
Before Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"forge_marker": 1,
|
||||
"defaults": {
|
||||
"model": "botania:dummy",
|
||||
"textures": {
|
||||
"particle": "botania:blocks/storage0"
|
||||
}
|
||||
},
|
||||
"variants": {
|
||||
"normal": [{}]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures":
|
||||
{
|
||||
"layer0": "advanced_botany:items/air_forgotten_lands"
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,6 @@
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures":
|
||||
{
|
||||
"layer0": "ab:items/air_forgotten_lands"
|
||||
"layer0": "advanced_botany:items/black_hole_box"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "botania:items/elven_spark"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"parent": "builtin/entity",
|
||||
"display": {
|
||||
"gui": {
|
||||
"rotation": [ 30, 225, 0 ],
|
||||
"translation": [ -0.25, 2.0, 0],
|
||||
"scale":[ 0.825, 0.825, 0.825 ]
|
||||
},
|
||||
"ground": {
|
||||
"rotation": [ 0, 0, 0 ],
|
||||
"translation": [ 0, 3, 0],
|
||||
"scale":[ 0.5, 0.5, 0.5 ]
|
||||
},
|
||||
"fixed": {
|
||||
"rotation": [ 0, 90, 0 ],
|
||||
"translation": [ 0.825, 2.75, 0],
|
||||
"scale":[ 0.825, 0.825, 0.825 ]
|
||||
},
|
||||
"thirdperson_righthand": {
|
||||
"rotation": [ 75, 45, 0 ],
|
||||
"translation": [ 0.0, 2.5, 1.5],
|
||||
"scale": [ 0.5, 0.5, 0.5 ]
|
||||
},
|
||||
"firstperson_righthand": {
|
||||
"rotation": [ 0, 45, 0 ],
|
||||
"translation": [ 0, 2.5, 0 ],
|
||||
"scale": [ 0.5, 0.5, 0.5 ]
|
||||
},
|
||||
"firstperson_lefthand": {
|
||||
"rotation": [ 0, 225, 0 ],
|
||||
"translation": [ 0, 2.5, 0 ],
|
||||
"scale": [ 0.40, 0.40, 0.40 ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,6 @@
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures":
|
||||
{
|
||||
"layer0": "ab:items/mana_nether_star"
|
||||
"layer0": "advanced_botany:items/mana_nether_star"
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,6 @@
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures":
|
||||
{
|
||||
"layer0": "ab:items/mithrill"
|
||||
"layer0": "advanced_botany:items/mithrill"
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,6 @@
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures":
|
||||
{
|
||||
"layer0": "ab:items/mithrill_nugget"
|
||||
"layer0": "advanced_botany:items/mithrill_nugget"
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,6 @@
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures":
|
||||
{
|
||||
"layer0": "ab:items/nature_gift"
|
||||
"layer0": "advanced_botany:items/nature_gift"
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,6 @@
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures":
|
||||
{
|
||||
"layer0": "ab:items/nebula_fragment"
|
||||
"layer0": "advanced_botany:items/nebula_fragment"
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,6 @@
|
||||
"parent": "minecraft:item/handheld",
|
||||
"textures":
|
||||
{
|
||||
"layer0": "ab:items/nebula_rod"
|
||||
"layer0": "advanced_botany:items/nebula_rod"
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,6 @@
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures":
|
||||
{
|
||||
"layer0": "ab:items/piece_nebula"
|
||||
"layer0": "advanced_botany:items/piece_nebula"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"parent": "minecraft:item/handheld",
|
||||
"textures": {
|
||||
"layer0": "advanced_botany:items/space_blade",
|
||||
"layer1": "advanced_botany:items/space_blade_overlay"
|
||||
},
|
||||
"overrides": [{
|
||||
"predicate": {
|
||||
"advanced_botany:enabled": 1
|
||||
},
|
||||
"model": "advanced_botany:item/space_blade_enabled"
|
||||
}]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"parent": "minecraft:item/handheld",
|
||||
"textures": {
|
||||
"layer0": "advanced_botany:items/space_blade_enabled",
|
||||
"layer1": "advanced_botany:items/space_blade_overlay"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"boardcube": { "sounds":["advanced_botany:boardcube"], "subtitle": "ab.subtitle.boardcube" },
|
||||
"nebulablaze": { "sounds":["advanced_botany:nebulablaze"], "subtitle": "ab.subtitle.nebulablaze" },
|
||||
"bladespace": { "sounds":["advanced_botany:bladespace"], "subtitle": "ab.subtitle.bladespace" },
|
||||
"nebularod": { "sounds":["advanced_botany:nebularod"], "subtitle": "ab.subtitle.nebularod" },
|
||||
"hornplentyusing": { "sounds":["advanced_botany:hornplentyusing"], "subtitle": "ab.subtitle.hornplentyusing" },
|
||||
"freyrslingshot": { "sounds":["advanced_botany:freyrslingshot"], "subtitle": "ab.subtitle.freyrslingshot" },
|
||||
"lokicubearmor": { "sounds":["advanced_botany:lokicubearmor"], "subtitle": "ab.subtitle.lokicubearmor" }
|
||||
}
|
||||
|
After Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"texture": {
|
||||
"blur": true
|
||||
}
|
||||
}
|
||||
|
||||
|
After Width: | Height: | Size: 4.8 KiB |