mirror of
https://github.com/GTNewHorizons/ThaumicTinkerer.git
synced 2026-11-28 16:06:07 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a0f95ee27b | ||
|
|
c27af147bf | ||
|
|
c101bb2e6d | ||
|
|
6c25bcee2a | ||
|
|
1f3e772def | ||
|
|
a6047ee7ec | ||
|
|
85189235ce | ||
|
|
964d3391e4 | ||
|
|
92b212d5e0 | ||
|
|
1972b9ab2b | ||
|
|
99e23607f5 | ||
|
|
63423b8913 |
No files matched your search
+15
-16
@@ -1,28 +1,27 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:Baubles-Expanded:2.2.6-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:Baubles-Expanded:2.2.21-GTNH:dev')
|
||||
api('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev') {transitive=false}
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-839-GTNH:api')
|
||||
api('com.github.GTNewHorizons:ThaumicBoots:1.5.8:dev') {transitive=false}
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-987-GTNH:api')
|
||||
api('com.github.GTNewHorizons:ThaumicBoots:1.5.12:dev') {transitive=false}
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:Botania:1.13.14-GTNH:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderCore:0.5.5:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.10.20:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderStorage:1.8.2:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:waila:1.19.22:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:TinkersConstruct:1.14.30-GTNH:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.7.2:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:CodeChickenCore:1.4.10:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.16-GTNH:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:Botania:1.13.25-GTNH:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderCore:0.5.14:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.10.31:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderStorage:1.8.3:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:waila:1.19.30:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:TinkersConstruct:1.14.93-GTNH:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.7.10:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:CodeChickenCore:1.4.16:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.47-GTNH:api') {transitive=false}
|
||||
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:api') {transitive=false}
|
||||
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.52.308:dev") {exclude group: 'com.github.GTNewHorizons', module: 'ThaumicTinkerer'}
|
||||
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.52.617:dev") {exclude group: 'com.github.GTNewHorizons', module: 'ThaumicTinkerer'}
|
||||
compileOnly('curse.maven:computercraft-67504:2269339')
|
||||
compileOnly('curse.maven:cofh-core-69162:2388751')
|
||||
|
||||
// For testing purposes
|
||||
//runtimeOnlyNonPublishable("com.github.GTNewHorizons:Electro-Magic-Tools:1.7.17:dev")
|
||||
//runtimeOnlyNonPublishable("com.github.GTNewHorizons:Electro-Magic-Tools:1.7.22:dev")
|
||||
|
||||
runtimeOnly(rfg.deobf('curse.maven:thaumcraft-nei-plugin-225095:2241913'))
|
||||
runtimeOnly('com.github.GTNewHorizons:TCNEIAdditions:1.5.13:dev')
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:AspectRecipeIndex:1.1.1:dev')
|
||||
}
|
||||
+1
-1
@@ -115,7 +115,7 @@ usesMixins = true
|
||||
separateMixinSourceSet =
|
||||
|
||||
# Adds some debug arguments like verbose output and class export.
|
||||
usesMixinDebug = true
|
||||
usesMixinDebug = false
|
||||
|
||||
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
||||
mixinPlugin =
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#This file is generated by updateDaemonJvm
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c5ee947fbfb70bc347d8d531e3a578c4/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/5ee463876563a46fff651cce1bc53a4c/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c5ee947fbfb70bc347d8d531e3a578c4/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/5ee463876563a46fff651cce1bc53a4c/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/e1118b4c7c2858d28154d086dbff010e/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/59a9771cad43219260d9aac9a8ec4d6a/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c5ee947fbfb70bc347d8d531e3a578c4/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/5ee463876563a46fff651cce1bc53a4c/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/832229f0f6f0be60ed817c5a5e5848eb/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/b96cb7670c095245220e7d01d5927b58/redirect
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/cf726b4a1c84b50457225f9bba6d7650/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/cf726b4a1c84b50457225f9bba6d7650/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c2dd35c9d0aaf0ba6ad0791320f99dfc/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/e5810bd7fd1f8a586644409d395a7e55/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/cf726b4a1c84b50457225f9bba6d7650/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/7b3c4877c0749019e6805bb61e421497/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/d76df094a9cbbabd3b08251f9e61444a/redirect
|
||||
toolchainVersion=25
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/b631911858264c0b6e4d6603d677ff5218766cee/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id("com.gtnewhorizons.gtnhsettingsconvention") version "2.0.20"
|
||||
id("com.gtnewhorizons.gtnhsettingsconvention") version "2.0.26"
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@ import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.network.FMLNetworkEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import thaumcraft.client.fx.ParticleEngine;
|
||||
import thaumic.tinkerer.client.core.handler.ClientTickHandler;
|
||||
@@ -59,13 +61,17 @@ import thaumic.tinkerer.common.block.tile.kami.TileWarpGate;
|
||||
import thaumic.tinkerer.common.block.tile.tablet.TileAnimationTablet;
|
||||
import thaumic.tinkerer.common.compat.FumeTool;
|
||||
import thaumic.tinkerer.common.core.handler.ConfigHandler;
|
||||
import thaumic.tinkerer.common.core.helper.EnumMobAspect;
|
||||
import thaumic.tinkerer.common.core.proxy.TTCommonProxy;
|
||||
import thaumic.tinkerer.common.item.ItemInfusedSeeds;
|
||||
import thaumic.tinkerer.common.item.ItemMobDisplay;
|
||||
import thaumic.tinkerer.common.item.kami.ItemPlacementMirror;
|
||||
import thaumic.tinkerer.common.item.kami.foci.ItemFocusShadowbeam;
|
||||
import thaumic.tinkerer.common.potion.PotionEffectHandlerClient;
|
||||
|
||||
public class TTClientProxy extends TTCommonProxy {
|
||||
public final class TTClientProxy extends TTCommonProxy {
|
||||
|
||||
private PotionEffectHandlerClient potionHandlerClient;
|
||||
|
||||
public static EntityPlayer getPlayer() {
|
||||
return Minecraft.getMinecraft().thePlayer;
|
||||
@@ -74,18 +80,21 @@ public class TTClientProxy extends TTCommonProxy {
|
||||
@Override
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
super.preInit(event);
|
||||
FMLCommonHandler.instance().bus().register(this);
|
||||
if (Loader.isModLoaded("ComputerCraft")) {
|
||||
MinecraftForge.EVENT_BUS.register(new FumeTool());
|
||||
}
|
||||
|
||||
if (ConfigHandler.enableKami)
|
||||
if (ConfigHandler.enableKami) {
|
||||
// kamiRarity = EnumHelperClient.addRarity("KAMI", 0x6, "Kami");
|
||||
|
||||
kamiRarity = EnumHelperClient.addEnum(
|
||||
new Class[][] { { EnumRarity.class, EnumChatFormatting.class, String.class } },
|
||||
EnumRarity.class,
|
||||
"KAMI",
|
||||
EnumChatFormatting.LIGHT_PURPLE,
|
||||
"Kami");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -108,6 +117,22 @@ public class TTClientProxy extends TTCommonProxy {
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onClientConnect(FMLNetworkEvent.ClientConnectedToServerEvent event) {
|
||||
this.potionHandlerClient = new PotionEffectHandlerClient();
|
||||
MinecraftForge.EVENT_BUS.register(potionHandlerClient);
|
||||
FMLCommonHandler.instance().bus().register(potionHandlerClient);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onClientDisconnect(FMLNetworkEvent.ClientDisconnectionFromServerEvent event) {
|
||||
if (this.potionHandlerClient != null) {
|
||||
MinecraftForge.EVENT_BUS.unregister(potionHandlerClient);
|
||||
FMLCommonHandler.instance().bus().unregister(potionHandlerClient);
|
||||
this.potionHandlerClient = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void registerTiles() {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileAnimationTablet.class, new RenderTileAnimationTablet());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileMagnet.class, new RenderTileMagnet());
|
||||
@@ -195,4 +220,9 @@ public class TTClientProxy extends TTCommonProxy {
|
||||
public EntityPlayer getClientPlayer() {
|
||||
return ClientHelper.clientPlayer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMobDisplayName(EnumMobAspect aspect) {
|
||||
return aspect.getEntity(Minecraft.getMinecraft().theWorld).getCommandSenderName();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package thaumic.tinkerer.client.nei;
|
||||
|
||||
import codechicken.nei.api.IConfigureNEI;
|
||||
import codechicken.nei.recipe.GuiCraftingRecipe;
|
||||
import codechicken.nei.recipe.GuiUsageRecipe;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
||||
public class NEIConfig implements IConfigureNEI {
|
||||
|
||||
@Override
|
||||
public void loadConfig() {
|
||||
if (!Loader.isModLoaded("aspectrecipeindex")) return;
|
||||
AspectRecipeIndexIntegration.register();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Thaumic Tinkerer NEI";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return "1.0";
|
||||
}
|
||||
|
||||
// This needs to be an inner class to prevent a NoClassDefFoundError from class loading when ARI isn't loaded.
|
||||
private static class AspectRecipeIndexIntegration {
|
||||
|
||||
public static void register() {
|
||||
TemplateRecipeHandler handler = new NEINecromancyHandler();
|
||||
GuiCraftingRecipe.craftinghandlers.add(handler);
|
||||
GuiUsageRecipe.usagehandlers.add(handler);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
package thaumic.tinkerer.client.nei;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.glease.tc4tweak.api.infusionrecipe.RecipeIngredient;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.gtnewhorizons.aspectrecipeindex.nei.InfusionRecipeHandler;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
import thaumic.tinkerer.common.core.helper.EnumMobAspect;
|
||||
import thaumic.tinkerer.common.item.ItemMobAspect;
|
||||
import thaumic.tinkerer.common.item.ItemMobDisplay;
|
||||
|
||||
public class NEINecromancyHandler extends InfusionRecipeHandler {
|
||||
|
||||
public static final String OVERLAY = "thaumictinkerer.necromancy";
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("tile.spawner.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverlayIdentifier() {
|
||||
return OVERLAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeHeight(int recipe) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if (outputId.equals(this.getOverlayIdentifier())) {
|
||||
for (EnumMobAspect value : EnumMobAspect.values()) {
|
||||
new NecromancyCachedRecipe(value);
|
||||
}
|
||||
} else if (outputId.equals("item")) {
|
||||
this.loadCraftingRecipes((ItemStack) results[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
if (result.getItem() instanceof ItemMobDisplay display) {
|
||||
EnumMobAspect type = display.getEntityType(result);
|
||||
for (EnumMobAspect value : EnumMobAspect.values()) {
|
||||
if (value == type) {
|
||||
new NecromancyCachedRecipe(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
loadUsageRecipes(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
if (!(ingredient.getItem() instanceof ItemMobAspect)) {
|
||||
return;
|
||||
}
|
||||
Aspect target = ItemMobAspect.getAspect(ingredient);
|
||||
if (target == null) return;
|
||||
for (EnumMobAspect value : EnumMobAspect.values()) {
|
||||
for (Aspect aspect : value.aspects) {
|
||||
if (aspect == target) {
|
||||
new NecromancyCachedRecipe(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(String inputId, Object... ingredients) {
|
||||
loadCraftingRecipes(inputId, ingredients);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground(int recipeIndex) {
|
||||
GL11.glPushMatrix();
|
||||
GuiDraw.changeTexture(THAUM_OVERLAYS);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glScalef(1.75F, 1.75F, 1.0F);
|
||||
GL11.glTranslatef(-0.5F, -1F, 0);
|
||||
GuiDraw.drawTexturedModalRect(27, 8, 207, 78, 42, 42); // Runic matrix drawing
|
||||
GL11.glTranslatef(0.5F, 1F, 0);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInstability(int recipeIndex) {}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int recipeIndex) {
|
||||
drawSeeAllRecipesLabel(2);
|
||||
}
|
||||
|
||||
protected class NecromancyCachedRecipe extends InfusionCachedRecipe {
|
||||
|
||||
public NecromancyCachedRecipe(EnumMobAspect enumMobAspect) {
|
||||
super(0, true);
|
||||
setIngredients(enumMobAspect.aspects);
|
||||
setResult(enumMobAspect);
|
||||
this.aspects = new AspectList();
|
||||
addIfValid();
|
||||
}
|
||||
|
||||
private void setResult(EnumMobAspect enumMobAspect) {
|
||||
ItemStack result = new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemMobDisplay.class));
|
||||
((ItemMobDisplay) result.getItem()).setEntityType(result, enumMobAspect);
|
||||
this.result = new PositionedStack(result, OUTPUT_X, 39, false);
|
||||
}
|
||||
|
||||
private void setIngredients(Aspect[] aspects) {
|
||||
if (aspects.length < 3) return;
|
||||
addSurroundingItems(
|
||||
Arrays.asList(
|
||||
RecipeIngredient.item(true, ItemMobAspect.getStackFromAspect(aspects[0])),
|
||||
RecipeIngredient.item(true, ItemMobAspect.getStackFromAspect(aspects[1])),
|
||||
RecipeIngredient.item(true, ItemMobAspect.getStackFromAspect(aspects[2]))));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int itemOffset() {
|
||||
return -24;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
@@ -28,67 +27,22 @@ public class RenderMobDisplay implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType itemRenderType, ItemStack itemStack, Object... objects) {
|
||||
ItemMobDisplay item = (ItemMobDisplay) itemStack.getItem();
|
||||
if (!(itemStack.getItem() instanceof ItemMobDisplay item)) return;
|
||||
EnumMobAspect aspect = item.getEntityType(itemStack);
|
||||
Entity entity = null;
|
||||
float f1 = 0.4f;
|
||||
float verticalOffset = 0.0f;
|
||||
if (aspect != null) {
|
||||
entity = EnumMobAspect.getEntityFromCache(aspect, null);
|
||||
f1 = aspect.getScale();
|
||||
verticalOffset = aspect.getVerticalOffset();
|
||||
}
|
||||
switch (itemRenderType) {
|
||||
case ENTITY:
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0.5, 0.2 + verticalOffset, 0.5);
|
||||
GL11.glRotatef(-30.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, -0.4F, 0.0F);
|
||||
GL11.glScalef(f1, f1, f1);
|
||||
EntityItem eItem = (EntityItem) objects[1];
|
||||
if (entity != null) {
|
||||
entity.worldObj = (Minecraft.getMinecraft() != null) ? Minecraft.getMinecraft().theWorld : null;
|
||||
if (entity.worldObj != null) {
|
||||
Render renderer = RenderManager.instance.getEntityRenderObject(entity);
|
||||
entity.setWorld(eItem.worldObj);
|
||||
entity.copyLocationAndAnglesFrom(eItem);
|
||||
if (renderer != null && renderer.getFontRendererFromRenderManager() != null) {
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
// if (renderWithLighting) RenderUtils.enableLightmap();
|
||||
renderer.doRender(entity, 0, 0, 0, 0, 0);
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
}
|
||||
entity.worldObj = null;
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
case EQUIPPED:
|
||||
break;
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
break;
|
||||
case INVENTORY:
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0.5, 0.2 + verticalOffset, 0.5);
|
||||
GL11.glRotatef(-30.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, -0.4F, 0.0F);
|
||||
GL11.glScalef(f1, f1, f1);
|
||||
if (entity != null) {
|
||||
entity.worldObj = (Minecraft.getMinecraft() != null) ? Minecraft.getMinecraft().theWorld : null;
|
||||
if (entity.worldObj != null) {
|
||||
Render renderer = RenderManager.instance.getEntityRenderObject(entity);
|
||||
if (renderer != null && renderer.getFontRendererFromRenderManager() != null) {
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
// if (renderWithLighting) RenderUtils.enableLightmap();
|
||||
renderer.doRender(entity, 0, 0, 0, 0, 0);
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
}
|
||||
entity.worldObj = null;
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
|
||||
case FIRST_PERSON_MAP:
|
||||
break;
|
||||
if (aspect == null) return;
|
||||
Entity entity = EnumMobAspect.getEntityFromCache(aspect, Minecraft.getMinecraft().theWorld);
|
||||
float scale = aspect.getScale();
|
||||
float offset = aspect.getVerticalOffset();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(-30.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
GL11.glTranslatef(0, (-entity.height / 2) + offset, 0.0F);
|
||||
Render renderer = RenderManager.instance.getEntityRenderObject(entity);
|
||||
if (renderer != null && renderer.getFontRendererFromRenderManager() != null) {
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
renderer.doRender(entity, 0, 0, 0, 0, 0);
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -13,9 +13,6 @@ package thaumic.tinkerer.common;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.command.ICommandManager;
|
||||
import net.minecraft.command.ServerCommandManager;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -31,14 +28,12 @@ import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
import thaumcraft.common.CommonProxy;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumic.tinkerer.api.InterModCommsOperations;
|
||||
import thaumic.tinkerer.common.core.commands.KamiUnlockedCommand;
|
||||
import thaumic.tinkerer.common.core.commands.MaxResearchCommand;
|
||||
import thaumic.tinkerer.common.core.commands.SetTendencyCommand;
|
||||
import thaumic.tinkerer.common.core.handler.ConfigHandler;
|
||||
import thaumic.tinkerer.common.core.proxy.TTCommonProxy;
|
||||
import thaumic.tinkerer.common.dim.WorldProviderBedrock;
|
||||
@@ -85,13 +80,27 @@ public class ThaumicTinkerer {
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void serverStart(FMLServerStartingEvent event) {
|
||||
MinecraftServer server = MinecraftServer.getServer();
|
||||
ICommandManager command = server.getCommandManager();
|
||||
ServerCommandManager manager = (ServerCommandManager) command;
|
||||
manager.registerCommand(new SetTendencyCommand());
|
||||
manager.registerCommand(new MaxResearchCommand());
|
||||
manager.registerCommand(new KamiUnlockedCommand());
|
||||
public void init(FMLInitializationEvent event) {
|
||||
proxy.init(event);
|
||||
if (ConfigHandler.enableKami && ConfigHandler.bedrockDimensionID != 0) {
|
||||
DimensionManager.registerProviderType(ConfigHandler.bedrockDimensionID, WorldProviderBedrock.class, false);
|
||||
DimensionManager.registerDimension(ConfigHandler.bedrockDimensionID, ConfigHandler.bedrockDimensionID);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
proxy.postInit(event);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void serverStarting(FMLServerStartingEvent event) {
|
||||
proxy.serverStarting(event);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void serverStopped(FMLServerStoppedEvent event) {
|
||||
proxy.serverStopped(event);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -111,18 +120,4 @@ public class ThaumicTinkerer {
|
||||
public void blackListCCDevices(String classname) {
|
||||
PeripheralHandler.Blacklist.add(classname);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
proxy.init(event);
|
||||
if (ConfigHandler.enableKami && ConfigHandler.bedrockDimensionID != 0) {
|
||||
DimensionManager.registerProviderType(ConfigHandler.bedrockDimensionID, WorldProviderBedrock.class, false);
|
||||
DimensionManager.registerDimension(ConfigHandler.bedrockDimensionID, ConfigHandler.bedrockDimensionID);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
proxy.postInit(event);
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,10 @@ package thaumic.tinkerer.common.block.tile;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.monster.EntitySkeleton;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
@@ -19,121 +19,115 @@ public class TileSummon extends TileEntity {
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if (worldObj.getTotalWorldTime() % 300 != 0
|
||||
|| worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (worldObj.getTotalWorldTime() % 300 == 0) {
|
||||
if (worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) {
|
||||
return;
|
||||
}
|
||||
for (int radius = 1; radius < 6; radius++) {
|
||||
ArrayList<TileEntity> pedestals = new ArrayList<>();
|
||||
for (int x = xCoord - radius; x <= xCoord + radius; x++) {
|
||||
for (int z = zCoord - radius; z <= zCoord + radius; z++) {
|
||||
TileEntity tile = worldObj.getTileEntity(x, yCoord, z);
|
||||
if (tile instanceof TilePedestal && ((TilePedestal) tile).getStackInSlot(0) != null
|
||||
&& ((TilePedestal) tile).getStackInSlot(0).getItem() instanceof ItemMobAspect) {
|
||||
pedestals.add(tile);
|
||||
}
|
||||
for (int radius = 1; radius < 6; radius++) {
|
||||
ArrayList<TilePedestal> pedestals = new ArrayList<>();
|
||||
for (int x = xCoord - radius; x <= xCoord + radius; x++) {
|
||||
for (int z = zCoord - radius; z <= zCoord + radius; z++) {
|
||||
TileEntity tile = worldObj.getTileEntity(x, yCoord, z);
|
||||
if (tile instanceof TilePedestal pedestal && pedestal.getStackInSlot(0) != null
|
||||
&& pedestal.getStackInSlot(0).getItem() instanceof ItemMobAspect) {
|
||||
pedestals.add(pedestal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < pedestals.size(); i++) {
|
||||
for (int j = 0; j < pedestals.size(); j++) {
|
||||
for (TileEntity pedestal : pedestals) {
|
||||
TilePedestal ped1 = (TilePedestal) pedestals.get(i);
|
||||
TilePedestal ped2 = (TilePedestal) pedestals.get(j);
|
||||
TilePedestal ped3 = (TilePedestal) pedestal;
|
||||
for (int i = 0; i < pedestals.size(); i++) {
|
||||
for (int j = 0; j < pedestals.size(); j++) {
|
||||
for (TilePedestal ped3 : pedestals) {
|
||||
TilePedestal ped1 = pedestals.get(i);
|
||||
TilePedestal ped2 = pedestals.get(j);
|
||||
|
||||
if ((ped1 != ped2) && (ped2 != ped3) && (ped1 != ped3)) {
|
||||
ArrayList<Aspect> aspects = new ArrayList<>();
|
||||
aspects.add(ItemMobAspect.getAspect(ped1.getStackInSlot(0)));
|
||||
if ((ped1 == ped2) || (ped2 == ped3) || (ped1 == ped3)) continue;
|
||||
ArrayList<Aspect> aspects = new ArrayList<>();
|
||||
aspects.add(ItemMobAspect.getAspect(ped1.getStackInSlot(0)));
|
||||
|
||||
aspects.add(ItemMobAspect.getAspect(ped2.getStackInSlot(0)));
|
||||
aspects.add(ItemMobAspect.getAspect(ped2.getStackInSlot(0)));
|
||||
|
||||
aspects.add(ItemMobAspect.getAspect(ped3.getStackInSlot(0)));
|
||||
aspects.add(ItemMobAspect.getAspect(ped3.getStackInSlot(0)));
|
||||
|
||||
for (EnumMobAspect recipe : EnumMobAspect.values()) {
|
||||
if (Arrays.asList(recipe.aspects).containsAll(aspects)
|
||||
&& aspects.containsAll(Arrays.asList(recipe.aspects))) {
|
||||
for (EnumMobAspect recipe : EnumMobAspect.values()) {
|
||||
if (!Arrays.asList(recipe.aspects).containsAll(aspects)
|
||||
|| !aspects.containsAll(Arrays.asList(recipe.aspects))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean isInfused = ItemMobAspect.isInfused(ped1.getStackInSlot(0))
|
||||
&& ItemMobAspect.isInfused(ped2.getStackInSlot(0))
|
||||
&& ItemMobAspect.isInfused(ped3.getStackInSlot(0));
|
||||
boolean isInfused = ItemMobAspect.isInfused(ped1.getStackInSlot(0))
|
||||
&& ItemMobAspect.isInfused(ped2.getStackInSlot(0))
|
||||
&& ItemMobAspect.isInfused(ped3.getStackInSlot(0));
|
||||
|
||||
if (isInfused && worldObj.getTotalWorldTime() % 1200 != 0) {
|
||||
return;
|
||||
}
|
||||
if (isInfused && worldObj.getTotalWorldTime() % 1200 != 0) return;
|
||||
|
||||
if (!isInfused) {
|
||||
ped1.setInventorySlotContents(0, null);
|
||||
ped2.setInventorySlotContents(0, null);
|
||||
ped3.setInventorySlotContents(0, null);
|
||||
}
|
||||
if (!isInfused) {
|
||||
ped1.setInventorySlotContents(0, null);
|
||||
ped2.setInventorySlotContents(0, null);
|
||||
ped3.setInventorySlotContents(0, null);
|
||||
}
|
||||
|
||||
if (!isInfused || ItemMobAspect
|
||||
.lastUsedTabletMatches(ped1.getStackInSlot(0), this)
|
||||
&& ItemMobAspect.lastUsedTabletMatches(ped2.getStackInSlot(0), this)
|
||||
&& ItemMobAspect.lastUsedTabletMatches(ped3.getStackInSlot(0), this)) {
|
||||
if (!isInfused || ItemMobAspect.lastUsedTabletMatches(ped1.getStackInSlot(0), this)
|
||||
&& ItemMobAspect.lastUsedTabletMatches(ped2.getStackInSlot(0), this)
|
||||
&& ItemMobAspect.lastUsedTabletMatches(ped3.getStackInSlot(0), this)) {
|
||||
|
||||
if (!worldObj.isRemote) {
|
||||
Entity spawn = EntityList
|
||||
.createEntityByName(recipe.toString(), worldObj);
|
||||
spawn.setLocationAndAngles(xCoord + .5, yCoord + 1, zCoord + .5, 0, 0);
|
||||
if (spawn instanceof EntitySkeleton && worldObj.provider.isHellWorld) {
|
||||
((EntitySkeleton) spawn).setSkeletonType(1);
|
||||
}
|
||||
worldObj.spawnEntityInWorld(spawn);
|
||||
((EntityLiving) spawn).onSpawnWithEgg(null);
|
||||
((EntityLiving) spawn).playLivingSound();
|
||||
}
|
||||
|
||||
if (worldObj.isRemote) {
|
||||
ThaumicTinkerer.tcProxy.essentiaTrailFx(
|
||||
worldObj,
|
||||
ped1.xCoord,
|
||||
ped1.yCoord,
|
||||
ped1.zCoord,
|
||||
xCoord,
|
||||
yCoord,
|
||||
zCoord,
|
||||
20,
|
||||
aspects.get(0).getColor(),
|
||||
20);
|
||||
ThaumicTinkerer.tcProxy.essentiaTrailFx(
|
||||
worldObj,
|
||||
ped2.xCoord,
|
||||
ped2.yCoord,
|
||||
ped2.zCoord,
|
||||
xCoord,
|
||||
yCoord,
|
||||
zCoord,
|
||||
20,
|
||||
aspects.get(1).getColor(),
|
||||
20);
|
||||
ThaumicTinkerer.tcProxy.essentiaTrailFx(
|
||||
worldObj,
|
||||
ped3.xCoord,
|
||||
ped3.yCoord,
|
||||
ped3.zCoord,
|
||||
xCoord,
|
||||
yCoord,
|
||||
zCoord,
|
||||
20,
|
||||
aspects.get(2).getColor(),
|
||||
20);
|
||||
}
|
||||
}
|
||||
if (isInfused) {
|
||||
ItemMobAspect.markLastUsedTablet(ped1.getStackInSlot(0), this);
|
||||
|
||||
ItemMobAspect.markLastUsedTablet(ped2.getStackInSlot(0), this);
|
||||
|
||||
ItemMobAspect.markLastUsedTablet(ped3.getStackInSlot(0), this);
|
||||
}
|
||||
|
||||
return;
|
||||
if (!worldObj.isRemote) {
|
||||
EntityLiving spawn = recipe.createEntity(worldObj);
|
||||
spawn.setLocationAndAngles(xCoord + .5, yCoord + 1, zCoord + .5, 0, 0);
|
||||
worldObj.spawnEntityInWorld(spawn);
|
||||
spawn.onSpawnWithEgg(null);
|
||||
if (spawn instanceof EntitySkeleton skeleton && skeleton.getSkeletonType() == 1) {
|
||||
// Needs to be done here instead of EnumMobAspect::setWither because
|
||||
// EntitySkeleton::onSpawnWithEgg sets the held item to a bow
|
||||
skeleton.setCurrentItemOrArmor(0, new ItemStack(Items.stone_sword));
|
||||
}
|
||||
spawn.playLivingSound();
|
||||
}
|
||||
|
||||
if (worldObj.isRemote) {
|
||||
ThaumicTinkerer.tcProxy.essentiaTrailFx(
|
||||
worldObj,
|
||||
ped1.xCoord,
|
||||
ped1.yCoord,
|
||||
ped1.zCoord,
|
||||
xCoord,
|
||||
yCoord,
|
||||
zCoord,
|
||||
20,
|
||||
aspects.get(0).getColor(),
|
||||
20);
|
||||
ThaumicTinkerer.tcProxy.essentiaTrailFx(
|
||||
worldObj,
|
||||
ped2.xCoord,
|
||||
ped2.yCoord,
|
||||
ped2.zCoord,
|
||||
xCoord,
|
||||
yCoord,
|
||||
zCoord,
|
||||
20,
|
||||
aspects.get(1).getColor(),
|
||||
20);
|
||||
ThaumicTinkerer.tcProxy.essentiaTrailFx(
|
||||
worldObj,
|
||||
ped3.xCoord,
|
||||
ped3.yCoord,
|
||||
ped3.zCoord,
|
||||
xCoord,
|
||||
yCoord,
|
||||
zCoord,
|
||||
20,
|
||||
aspects.get(2).getColor(),
|
||||
20);
|
||||
}
|
||||
}
|
||||
if (isInfused) {
|
||||
ItemMobAspect.markLastUsedTablet(ped1.getStackInSlot(0), this);
|
||||
ItemMobAspect.markLastUsedTablet(ped2.getStackInSlot(0), this);
|
||||
ItemMobAspect.markLastUsedTablet(ped3.getStackInSlot(0), this);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package thaumic.tinkerer.common.compat;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import ic2.api.item.ElectricItem;
|
||||
|
||||
public class EMTCompat {
|
||||
|
||||
@@ -13,4 +16,12 @@ public class EMTCompat {
|
||||
public static void init() {
|
||||
electricHoe = GameRegistry.findItem("EMT", "ElectricHoeGrowth");
|
||||
}
|
||||
|
||||
public static boolean validElectricHoe(ItemStack stack) {
|
||||
return EMTLoaded && stack.getItem() == EMTCompat.electricHoe && ElectricItem.manager.canUse(stack, 250);
|
||||
}
|
||||
|
||||
public static void useEnergy(ItemStack hoeOfGrowth, EntityPlayer player) {
|
||||
ElectricItem.manager.use(hoeOfGrowth, 250, player);
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ public class AspectCropLootManager {
|
||||
Random rand = new Random();
|
||||
int randInt = rand.nextInt(sum);
|
||||
for (Map.Entry<ItemStack, Integer> pair : aspectHashmap.entrySet()) {
|
||||
if (randInt <= 0) {
|
||||
if (randInt < pair.getValue()) {
|
||||
return pair.getKey().copy();
|
||||
}
|
||||
randInt -= pair.getValue();
|
||||
@@ -55,15 +55,7 @@ public class AspectCropLootManager {
|
||||
}
|
||||
|
||||
public static void addAspectLoot(Aspect aspect, String target) {
|
||||
|
||||
addAspectLoot(aspect, target, 1);
|
||||
for (String ore : OreDictionary.getOreNames()) {
|
||||
if (ore.contains(WordUtils.capitalizeFully(target)) || ore.contains(target)) {
|
||||
for (ItemStack stack : OreDictionary.getOres(ore)) {
|
||||
addAspectLoot(aspect, stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void addAspectLoot(Aspect aspect, String target, int count) {
|
||||
@@ -217,8 +209,7 @@ public class AspectCropLootManager {
|
||||
addAspectLoot(Aspect.MAGIC, new ItemStack(ConfigItems.itemShard, 1, 6));
|
||||
|
||||
addAspectLoot(Aspect.HEAL, new ItemStack(Items.golden_apple));
|
||||
|
||||
addAspectLoot(Aspect.HEAL, new ItemStack(Blocks.cake));
|
||||
addAspectLoot(Aspect.HEAL, new ItemStack(Items.cake));
|
||||
|
||||
addAspectLoot(Aspect.SENSES, new ItemStack(Items.dye, 20, 4));
|
||||
|
||||
|
||||
@@ -2,7 +2,10 @@ package thaumic.tinkerer.common.core.helper;
|
||||
|
||||
import static thaumic.tinkerer.common.compat.EMTCompat.EMTLoaded;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.entity.player.BonemealEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
|
||||
@@ -31,20 +34,20 @@ public class BonemealEventHandler {
|
||||
|
||||
public static boolean isMagicHoe(ItemStack stack) {
|
||||
if (stack == null) return false;
|
||||
var item = stack.getItem();
|
||||
return item == ConfigItems.itemHoeElemental || (EMTLoaded && item == EMTCompat.electricHoe);
|
||||
Item item = stack.getItem();
|
||||
return item == ConfigItems.itemHoeElemental || EMTCompat.validElectricHoe(stack);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
var world = event.world;
|
||||
World world = event.world;
|
||||
if (world.isRemote) return;
|
||||
if (!(world.getBlock(event.x, event.y, event.z) instanceof BlockInfusedGrain infusedGrain)) return;
|
||||
|
||||
var player = event.entityPlayer;
|
||||
EntityPlayer player = event.entityPlayer;
|
||||
if (player == null) return;
|
||||
|
||||
var hoeOfGrowth = player.getCurrentEquippedItem();
|
||||
ItemStack hoeOfGrowth = player.getCurrentEquippedItem();
|
||||
if (!isMagicHoe(hoeOfGrowth)) return;
|
||||
|
||||
if (!infusedGrain.func_149851_a(world, event.x, event.y, event.z, false)
|
||||
@@ -52,7 +55,7 @@ public class BonemealEventHandler {
|
||||
return;
|
||||
}
|
||||
infusedGrain.func_149853_b(world, world.rand, event.x, event.y, event.z);
|
||||
hoeOfGrowth.damageItem(25, player);
|
||||
damageHoe(hoeOfGrowth, player);
|
||||
Thaumcraft.proxy.blockSparkle(world, event.x, event.y, event.z, 0, 2);
|
||||
world.playSoundEffect(
|
||||
event.x + 0.5D,
|
||||
@@ -62,4 +65,12 @@ public class BonemealEventHandler {
|
||||
0.75F,
|
||||
0.9F + world.rand.nextFloat() * 0.2F);
|
||||
}
|
||||
|
||||
private static void damageHoe(ItemStack hoeOfGrowth, EntityPlayer player) {
|
||||
if (EMTLoaded && hoeOfGrowth.getItem() == EMTCompat.electricHoe) {
|
||||
EMTCompat.useEnergy(hoeOfGrowth, player);
|
||||
} else {
|
||||
hoeOfGrowth.damageItem(25, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,16 @@
|
||||
package thaumic.tinkerer.common.core.helper;
|
||||
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.invoke.MethodType;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.monster.EntityBlaze;
|
||||
import net.minecraft.entity.monster.EntityCaveSpider;
|
||||
import net.minecraft.entity.monster.EntityCreeper;
|
||||
@@ -30,101 +37,130 @@ import net.minecraft.entity.passive.EntitySheep;
|
||||
import net.minecraft.entity.passive.EntitySquid;
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
import net.minecraft.entity.passive.EntityWolf;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.crafting.InfusionRecipe;
|
||||
import thaumcraft.api.research.ResearchPage;
|
||||
import thaumcraft.common.entities.monster.EntityBrainyZombie;
|
||||
import thaumcraft.common.entities.monster.EntityFireBat;
|
||||
import thaumcraft.common.entities.monster.EntityWisp;
|
||||
import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
import thaumic.tinkerer.common.block.BlockSummon;
|
||||
import thaumic.tinkerer.common.item.ItemMobAspect;
|
||||
import thaumic.tinkerer.common.item.ItemMobDisplay;
|
||||
import thaumic.tinkerer.common.lib.LibResearch;
|
||||
|
||||
public enum EnumMobAspect {
|
||||
|
||||
SnowMan(EntitySnowman.class, new Aspect[] { Aspect.WATER, Aspect.WATER, Aspect.MAN }),
|
||||
Bat(EntityBat.class, new Aspect[] { Aspect.AIR, Aspect.AIR, Aspect.FLIGHT }, 1.9f, -0.3f),
|
||||
Blaze(EntityBlaze.class, new Aspect[] { Aspect.FIRE, Aspect.FIRE, Aspect.FIRE }),
|
||||
BrainyZombie(EntityBrainyZombie.class, new Aspect[] { Aspect.MAGIC, Aspect.UNDEAD, Aspect.FLESH }, "Thaumcraft."),
|
||||
Firebat(EntityFireBat.class, new Aspect[] { Aspect.FLIGHT, Aspect.FIRE, Aspect.MAGIC }, 1.9f, -0.3f),
|
||||
CaveSpider(EntityCaveSpider.class, new Aspect[] { Aspect.BEAST, Aspect.POISON, Aspect.POISON }),
|
||||
Chicken(EntityChicken.class, new Aspect[] { Aspect.CROP, Aspect.FLIGHT, Aspect.BEAST }),
|
||||
Cow(EntityCow.class, new Aspect[] { Aspect.BEAST, Aspect.EARTH, Aspect.BEAST }),
|
||||
Creeper(EntityCreeper.class, new Aspect[] { Aspect.MAGIC, Aspect.BEAST, Aspect.ELDRITCH }),
|
||||
Enderman(EntityEnderman.class, new Aspect[] { Aspect.ELDRITCH, Aspect.ELDRITCH, Aspect.MAN }, 0.3f, 0.0f),
|
||||
Ghast(EntityGhast.class, new Aspect[] { Aspect.FIRE, Aspect.FLIGHT, Aspect.FLIGHT }, 0.1f, 0.2f),
|
||||
EntityHorse(EntityHorse.class, new Aspect[] { Aspect.BEAST, Aspect.BEAST, Aspect.TRAVEL }),
|
||||
VillagerGolem(EntityIronGolem.class, new Aspect[] { Aspect.METAL, Aspect.METAL, Aspect.MAN }, 0.3f, 0.0f),
|
||||
LavaSlime(EntityMagmaCube.class, new Aspect[] { Aspect.FIRE, Aspect.SLIME, Aspect.SLIME }, 0.6f, 0.0f) {
|
||||
|
||||
@Override
|
||||
protected Entity createEntity(World worldObj) {
|
||||
return setSlimeSize(super.createEntity(worldObj), 1);
|
||||
}
|
||||
},
|
||||
MushroomCow(EntityMooshroom.class, new Aspect[] { Aspect.BEAST, Aspect.EARTH, Aspect.CROP }),
|
||||
Ozelot(EntityOcelot.class, new Aspect[] { Aspect.BEAST, Aspect.EARTH, Aspect.ELDRITCH }),
|
||||
// Passive
|
||||
Chicken(EntityChicken.class, new Aspect[] { Aspect.CROP, Aspect.FLIGHT, Aspect.BEAST }, 1.0f),
|
||||
Pig(EntityPig.class, new Aspect[] { Aspect.BEAST, Aspect.EARTH, Aspect.TRAVEL }),
|
||||
PigZombie(EntityPigZombie.class, new Aspect[] { Aspect.UNDEAD, Aspect.FLESH, Aspect.FIRE }),
|
||||
Sheep(EntitySheep.class, new Aspect[] { Aspect.EARTH, Aspect.CLOTH, Aspect.BEAST }),
|
||||
Silverfish(EntitySilverfish.class, new Aspect[] { Aspect.METAL, Aspect.METAL, Aspect.EARTH }),
|
||||
Skeleton(EntitySkeleton.class, new Aspect[] { Aspect.UNDEAD, Aspect.MAN, Aspect.UNDEAD }),
|
||||
Slime(EntitySlime.class, new Aspect[] { Aspect.SLIME, Aspect.SLIME, Aspect.BEAST }, 0.6f, 0.0f) {
|
||||
/// Must be before Cow because EntityMooshroom extends EntityCow
|
||||
MushroomCow(EntityMooshroom.class, new Aspect[] { Aspect.BEAST, Aspect.EARTH, Aspect.CROP }, 0.9f),
|
||||
Cow(EntityCow.class, new Aspect[] { Aspect.BEAST, Aspect.EARTH, Aspect.BEAST }, 0.9f),
|
||||
Sheep(EntitySheep.class, new Aspect[] { Aspect.EARTH, Aspect.CLOTH, Aspect.BEAST }, 0.9f),
|
||||
Ozelot(EntityOcelot.class, new Aspect[] { Aspect.BEAST, Aspect.EARTH, Aspect.ELDRITCH }),
|
||||
Wolf(EntityWolf.class, new Aspect[] { Aspect.BEAST, Aspect.BEAST, Aspect.BEAST }),
|
||||
EntityHorse(EntityHorse.class, new Aspect[] { Aspect.BEAST, Aspect.BEAST, Aspect.TRAVEL }, 0.8f),
|
||||
SnowMan(EntitySnowman.class, new Aspect[] { Aspect.WATER, Aspect.WATER, Aspect.MAN }, 0.8f),
|
||||
VillagerGolem(EntityIronGolem.class, new Aspect[] { Aspect.METAL, Aspect.METAL, Aspect.MAN }, 0.6f),
|
||||
Villager(EntityVillager.class, new Aspect[] { Aspect.MAN, Aspect.MAN, Aspect.MAN }, 0.8f),
|
||||
Squid(EntitySquid.class, new Aspect[] { Aspect.WATER, Aspect.WATER, Aspect.WATER }, 0.6f, 0.75f),
|
||||
Bat(EntityBat.class, new Aspect[] { Aspect.AIR, Aspect.AIR, Aspect.FLIGHT }, 1.9f),
|
||||
// Hostiles
|
||||
Blaze(EntityBlaze.class, new Aspect[] { Aspect.FIRE, Aspect.FIRE, Aspect.FIRE }, 0.8f),
|
||||
PigZombie(EntityPigZombie.class, new Aspect[] { Aspect.UNDEAD, Aspect.FLESH, Aspect.FIRE }, 0.8f),
|
||||
/// Must be before Slime because EntityMagmaCube extends EntitySlime
|
||||
LavaSlime(EntityMagmaCube.class, new Aspect[] { Aspect.FIRE, Aspect.SLIME, Aspect.SLIME }, 1.5f) {
|
||||
|
||||
@Override
|
||||
protected Entity createEntity(World worldObj) {
|
||||
public EntityLiving createEntity(World worldObj) {
|
||||
return setSlimeSize(super.createEntity(worldObj), 1);
|
||||
}
|
||||
},
|
||||
Spider(EntitySpider.class, new Aspect[] { Aspect.BEAST, Aspect.UNDEAD, Aspect.UNDEAD }),
|
||||
Squid(EntitySquid.class, new Aspect[] { Aspect.WATER, Aspect.WATER, Aspect.WATER }, 0.3f, 0.5f),
|
||||
Villager(EntityVillager.class, new Aspect[] { Aspect.MAN, Aspect.MAN, Aspect.MAN }),
|
||||
Wisp(EntityWisp.class, new Aspect[] { Aspect.AIR, Aspect.MAGIC, Aspect.MAGIC }, "Thaumcraft."),
|
||||
Witch(EntityWitch.class, new Aspect[] { Aspect.MAGIC, Aspect.UNDEAD, Aspect.ELDRITCH }, 0.35f, 0.0f),
|
||||
Wolf(EntityWolf.class, new Aspect[] { Aspect.BEAST, Aspect.BEAST, Aspect.BEAST }),
|
||||
Zombie(EntityZombie.class, new Aspect[] { Aspect.FLESH, Aspect.FLESH, Aspect.UNDEAD });
|
||||
Ghast(EntityGhast.class, new Aspect[] { Aspect.FIRE, Aspect.FLIGHT, Aspect.FLIGHT }, 0.2f, 0.6f),
|
||||
Firebat(EntityFireBat.class, new Aspect[] { Aspect.FLIGHT, Aspect.FIRE, Aspect.MAGIC }, 1.9f, 0f),
|
||||
/// Must be before Zombie because EntityBrainyZombie extends EntityZombie
|
||||
BrainyZombie(EntityBrainyZombie.class, new Aspect[] { Aspect.MAGIC, Aspect.UNDEAD, Aspect.FLESH }, 0.8f, 0),
|
||||
Zombie(EntityZombie.class, new Aspect[] { Aspect.FLESH, Aspect.FLESH, Aspect.UNDEAD }, 0.8f),
|
||||
Skeleton(EntitySkeleton.class, new Aspect[] { Aspect.UNDEAD, Aspect.MAN, Aspect.UNDEAD }, 0.8f) {
|
||||
|
||||
public static Map<EnumMobAspect, Entity> entityCache = Maps.newHashMap();
|
||||
public Aspect[] aspects;
|
||||
public Class entity;
|
||||
public String prefix;
|
||||
private float scale;
|
||||
private float offset;
|
||||
@Override
|
||||
public boolean matches(EntityLiving e) {
|
||||
if (e instanceof EntitySkeleton skeleton) {
|
||||
return skeleton.getSkeletonType() == 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
},
|
||||
WitherSkeleton(EntitySkeleton.class, new Aspect[] { Aspect.UNDEAD, Aspect.POISON, Aspect.FIRE }, 0.8f) {
|
||||
|
||||
EnumMobAspect(Class entity, Aspect[] aspects, float scale, float offset) {
|
||||
@Override
|
||||
public EntityLiving createEntity(World worldObj) {
|
||||
return setWither(super.createEntity(worldObj));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(EntityLiving e) {
|
||||
if (e instanceof EntitySkeleton skeleton) {
|
||||
return skeleton.getSkeletonType() == 1;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
},
|
||||
Creeper(EntityCreeper.class, new Aspect[] { Aspect.MAGIC, Aspect.BEAST, Aspect.ELDRITCH }, 0.8f),
|
||||
Witch(EntityWitch.class, new Aspect[] { Aspect.MAGIC, Aspect.UNDEAD, Aspect.ELDRITCH }, 0.8f),
|
||||
/// Must be before Spider because EntityCaveSpider extends EntitySpider
|
||||
CaveSpider(EntityCaveSpider.class, new Aspect[] { Aspect.BEAST, Aspect.POISON, Aspect.POISON }, 0.8f),
|
||||
Spider(EntitySpider.class, new Aspect[] { Aspect.BEAST, Aspect.UNDEAD, Aspect.UNDEAD }, 0.8f),
|
||||
Slime(EntitySlime.class, new Aspect[] { Aspect.SLIME, Aspect.SLIME, Aspect.BEAST }, 1.5f) {
|
||||
|
||||
@Override
|
||||
public EntityLiving createEntity(World worldObj) {
|
||||
return setSlimeSize(super.createEntity(worldObj), 1);
|
||||
}
|
||||
},
|
||||
Silverfish(EntitySilverfish.class, new Aspect[] { Aspect.METAL, Aspect.METAL, Aspect.EARTH }, 1.2f),
|
||||
Enderman(EntityEnderman.class, new Aspect[] { Aspect.ELDRITCH, Aspect.ELDRITCH, Aspect.MAN }, 0.7f),
|
||||
Wisp(EntityWisp.class, new Aspect[] { Aspect.AIR, Aspect.MAGIC, Aspect.MAGIC });
|
||||
|
||||
public static final Map<EnumMobAspect, EntityLiving> entityCache = Maps.newHashMap();
|
||||
private static final Map<String, EnumMobAspect> LOOKUP = Arrays.stream(values())
|
||||
.collect(Collectors.toMap(Enum::name, Function.identity()));
|
||||
public final Aspect[] aspects;
|
||||
public final Class<? extends EntityLiving> entity;
|
||||
private final float scale;
|
||||
private final float offset;
|
||||
private final MethodHandle ctor;
|
||||
|
||||
EnumMobAspect(Class<? extends EntityLiving> entity, Aspect[] aspects, float scale) {
|
||||
this(entity, aspects, scale, 0);
|
||||
}
|
||||
|
||||
EnumMobAspect(Class<? extends EntityLiving> entity, Aspect[] aspects, float scale, float offset) {
|
||||
this.aspects = aspects;
|
||||
this.entity = entity;
|
||||
this.scale = scale;
|
||||
this.offset = offset;
|
||||
MethodHandles.Lookup lookup = MethodHandles.lookup();
|
||||
try {
|
||||
this.ctor = lookup.findConstructor(entity, MethodType.methodType(void.class, World.class));
|
||||
} catch (NoSuchMethodException | IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
EnumMobAspect(Class entity, Aspect[] aspects, float scale, float offset, String prefix) {
|
||||
this(entity, aspects, scale, offset);
|
||||
this.prefix = prefix;
|
||||
EnumMobAspect(Class<? extends EntityLiving> entity, Aspect[] aspects) {
|
||||
this(entity, aspects, 1.0f);
|
||||
}
|
||||
|
||||
EnumMobAspect(Class entity, Aspect[] aspects) {
|
||||
this.aspects = aspects;
|
||||
this.entity = entity;
|
||||
this.scale = 1.1f;
|
||||
this.offset = 0.0f;
|
||||
public static EnumMobAspect get(String name) {
|
||||
return LOOKUP.get(name);
|
||||
}
|
||||
|
||||
EnumMobAspect(Class entity, Aspect[] aspects, String prefix) {
|
||||
this(entity, aspects);
|
||||
this.prefix = prefix;
|
||||
}
|
||||
|
||||
public static Entity getEntityFromCache(EnumMobAspect ent, World worldObj) {
|
||||
Entity entity = entityCache.get(ent);
|
||||
public static EntityLiving getEntityFromCache(EnumMobAspect ent, World worldObj) {
|
||||
EntityLiving entity = entityCache.get(ent);
|
||||
if (entity == null) {
|
||||
entity = ent.createEntity(worldObj);
|
||||
entityCache.put(ent, entity);
|
||||
@@ -132,37 +168,34 @@ public enum EnumMobAspect {
|
||||
return entity;
|
||||
}
|
||||
|
||||
private static Entity setSlimeSize(Entity entity, int size) {
|
||||
|
||||
if (entity instanceof EntitySlime) {
|
||||
((EntitySlime) entity).setSlimeSize(1);
|
||||
private static EntityLiving setSlimeSize(EntityLiving entity, int size) {
|
||||
if (entity instanceof EntitySlime slime) {
|
||||
slime.setSlimeSize(size);
|
||||
}
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
public static Aspect[] getAspectsForEntity(Entity e) {
|
||||
return getAspectsForEntity(e.getClass());
|
||||
private static EntityLiving setWither(EntityLiving entity) {
|
||||
if (entity instanceof EntitySkeleton skeleton) {
|
||||
skeleton.setSkeletonType(1);
|
||||
skeleton.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(4.0D);
|
||||
}
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
public static EnumMobAspect getMobAspectForType(String name) {
|
||||
if (name.isEmpty()) return null;
|
||||
Class clazz = (Class) EntityList.stringToClassMapping.get(name);
|
||||
for (EnumMobAspect e : EnumMobAspect.values()) {
|
||||
if (e.entity.isAssignableFrom(clazz)) {
|
||||
return e;
|
||||
public static Aspect[] getAspectsForEntity(EntityLiving e) {
|
||||
for (EnumMobAspect aspect : EnumMobAspect.values()) {
|
||||
if (aspect.matches(e)) {
|
||||
return aspect.aspects;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Aspect[] getAspectsForEntity(Class clazz) {
|
||||
for (EnumMobAspect e : EnumMobAspect.values()) {
|
||||
if (e.entity.isAssignableFrom(clazz)) {
|
||||
return e.aspects;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
public boolean matches(EntityLiving e) {
|
||||
return this.entity.isInstance(e);
|
||||
}
|
||||
|
||||
public float getVerticalOffset() {
|
||||
@@ -173,38 +206,31 @@ public enum EnumMobAspect {
|
||||
return scale;
|
||||
}
|
||||
|
||||
public Class getEntityClass() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
public Entity getEntity(World worldObj) {
|
||||
public EntityLiving getEntity(World worldObj) {
|
||||
return getEntityFromCache(this, worldObj);
|
||||
}
|
||||
|
||||
protected Entity createEntity(World worldObj) {
|
||||
return EntityList.createEntityByName(toString(), worldObj);
|
||||
}
|
||||
|
||||
public ResearchPage GetRecepiePage() {
|
||||
ItemStack output = new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemMobAspect.class));
|
||||
((ItemMobDisplay) output.getItem()).setEntityType(output, toString());
|
||||
ItemStack[] inputs = new ItemStack[this.aspects.length];
|
||||
int i = 0;
|
||||
for (Aspect a : this.aspects) {
|
||||
inputs[i++] = ItemMobAspect.getStackFromAspect(a);
|
||||
public EntityLiving createEntity(World worldObj) {
|
||||
try {
|
||||
return (EntityLiving) ctor.invoke(worldObj);
|
||||
} catch (Throwable e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
InfusionRecipe recepie = new InfusionRecipe(
|
||||
LibResearch.KEY_SUMMON,
|
||||
output,
|
||||
0,
|
||||
new AspectList(),
|
||||
new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockSummon.class)),
|
||||
inputs);
|
||||
return new ResearchPage(recepie);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return prefix == null ? super.toString() : prefix + super.toString();
|
||||
static {
|
||||
MinecraftForge.EVENT_BUS.register(new EventHandler());
|
||||
}
|
||||
|
||||
public static class EventHandler {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void onWorldUnload(WorldEvent.Unload event) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if (event.world == mc.theWorld) {
|
||||
entityCache.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +1,42 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* <p>
|
||||
* ThaumicTinkerer is Open Source and distributed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0
|
||||
* License (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* <p>
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 4. Thaumcraft 4 (c) Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* <p>
|
||||
* File Created @ [4 Sep 2013, 16:29:41 (GMT)]
|
||||
*/
|
||||
package thaumic.tinkerer.common.core.proxy;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.command.ICommandManager;
|
||||
import net.minecraft.command.ServerCommandManager;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
|
||||
import codechicken.nei.event.NEIRegisterHandlerInfosEvent;
|
||||
import codechicken.nei.recipe.HandlerInfo;
|
||||
import codechicken.nei.recipe.RecipeCatalysts;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import dan200.computercraft.api.ComputerCraftAPI;
|
||||
@@ -47,13 +57,18 @@ import thaumcraft.common.tiles.TileNode;
|
||||
import thaumcraft.common.tiles.TileSensor;
|
||||
import thaumcraft.common.tiles.TileTubeFilter;
|
||||
import thaumcraft.common.tiles.TileWandPedestal;
|
||||
import thaumic.tinkerer.client.nei.NEINecromancyHandler;
|
||||
import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
import thaumic.tinkerer.common.block.BlockSummon;
|
||||
import thaumic.tinkerer.common.block.tile.TileFunnel;
|
||||
import thaumic.tinkerer.common.block.tile.TileRepairer;
|
||||
import thaumic.tinkerer.common.block.tile.transvector.TileTransvectorInterface;
|
||||
import thaumic.tinkerer.common.compat.EMTCompat;
|
||||
import thaumic.tinkerer.common.compat.EnderIO;
|
||||
import thaumic.tinkerer.common.compat.FumeTool;
|
||||
import thaumic.tinkerer.common.core.commands.KamiUnlockedCommand;
|
||||
import thaumic.tinkerer.common.core.commands.MaxResearchCommand;
|
||||
import thaumic.tinkerer.common.core.commands.SetTendencyCommand;
|
||||
import thaumic.tinkerer.common.core.handler.ConfigHandler;
|
||||
import thaumic.tinkerer.common.core.handler.ModCreativeTab;
|
||||
import thaumic.tinkerer.common.core.handler.kami.DimensionalShardDropHandler;
|
||||
@@ -62,9 +77,11 @@ import thaumic.tinkerer.common.core.handler.kami.KamiDimensionHandler;
|
||||
import thaumic.tinkerer.common.core.handler.kami.SoulHeartHandler;
|
||||
import thaumic.tinkerer.common.core.helper.AspectCropLootManager;
|
||||
import thaumic.tinkerer.common.core.helper.BonemealEventHandler;
|
||||
import thaumic.tinkerer.common.core.helper.EnumMobAspect;
|
||||
import thaumic.tinkerer.common.core.helper.NumericAspectHelper;
|
||||
import thaumic.tinkerer.common.enchantment.ModEnchantments;
|
||||
import thaumic.tinkerer.common.enchantment.core.EnchantmentManager;
|
||||
import thaumic.tinkerer.common.item.ItemBloodSword;
|
||||
import thaumic.tinkerer.common.item.SpellClothCraftingHandler;
|
||||
import thaumic.tinkerer.common.item.foci.ItemFocusDeflect;
|
||||
import thaumic.tinkerer.common.item.kami.wand.CapIchor;
|
||||
@@ -89,6 +106,7 @@ import thaumic.tinkerer.common.peripheral.OpenComputers.DriverEssentiaTransport;
|
||||
import thaumic.tinkerer.common.peripheral.OpenComputers.DriverIAspectContainer;
|
||||
import thaumic.tinkerer.common.peripheral.PeripheralHandler;
|
||||
import thaumic.tinkerer.common.potion.ModPotions;
|
||||
import thaumic.tinkerer.common.potion.PotionEffectHandlerServer;
|
||||
import thaumic.tinkerer.common.research.ResearchHelper;
|
||||
|
||||
public class TTCommonProxy {
|
||||
@@ -97,6 +115,7 @@ public class TTCommonProxy {
|
||||
public WandCap capIchor;
|
||||
public WandRod rodIchor;
|
||||
public Item.ToolMaterial toolMaterialIchor;
|
||||
private PotionEffectHandlerServer potionHandlerServer;
|
||||
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
toolMaterialIchor = EnumHelper.addToolMaterial("ICHOR", 4, -1, 10F, 5F, 25);
|
||||
@@ -114,7 +133,6 @@ public class TTCommonProxy {
|
||||
if (Loader.isModLoaded("ComputerCraft")) {
|
||||
initCCPeripherals();
|
||||
}
|
||||
registerVersionChecker();
|
||||
|
||||
kamiRarity = EnumHelper.addEnum(
|
||||
new Class[][] { { EnumRarity.class, EnumChatFormatting.class, String.class } },
|
||||
@@ -160,46 +178,13 @@ public class TTCommonProxy {
|
||||
ThaumicTinkerer.log.info("Skipping TC Multipart integration");
|
||||
}
|
||||
|
||||
if (Loader.isModLoaded("NotEnoughItems") && Loader.isModLoaded("aspectrecipeindex")) {
|
||||
MinecraftForge.EVENT_BUS.register(new NEIEventHandler());
|
||||
}
|
||||
|
||||
EMTCompat.init();
|
||||
}
|
||||
|
||||
protected void registerPackets() {
|
||||
ThaumicTinkerer.netHandler
|
||||
.registerMessage(PacketSoulHearts.class, PacketSoulHearts.class, 142 + 0, Side.CLIENT);
|
||||
ThaumicTinkerer.netHandler
|
||||
.registerMessage(PacketToggleArmor.class, PacketToggleArmor.class, 142 + 1, Side.CLIENT);
|
||||
ThaumicTinkerer.netHandler
|
||||
.registerMessage(PacketToggleArmor.class, PacketToggleArmor.class, 142 + 2, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler
|
||||
.registerMessage(PacketWarpGateButton.class, PacketWarpGateButton.class, 142 + 3, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler
|
||||
.registerMessage(PacketWarpGateTeleport.class, PacketWarpGateTeleport.class, 142 + 4, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler.registerMessage(
|
||||
PacketEnchanterAddEnchant.class,
|
||||
PacketEnchanterAddEnchant.class,
|
||||
142 + 5,
|
||||
Side.SERVER);
|
||||
ThaumicTinkerer.netHandler.registerMessage(
|
||||
PacketEnchanterStartWorking.class,
|
||||
PacketEnchanterStartWorking.class,
|
||||
142 + 6,
|
||||
Side.SERVER);
|
||||
ThaumicTinkerer.netHandler
|
||||
.registerMessage(PacketMobMagnetButton.class, PacketMobMagnetButton.class, 142 + 7, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler
|
||||
.registerMessage(PacketTabletButton.class, PacketTabletButton.class, 142 + 8, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler
|
||||
.registerMessage(PacketPlacerButton.class, PacketPlacerButton.class, 142 + 9, Side.SERVER);
|
||||
}
|
||||
|
||||
public void registerVersionChecker() {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setString("curseProjectName", "75598-thaumic-tinkerer");
|
||||
compound.setString("curseFilenameParser", "ThaumicTinkerer-[].jar");
|
||||
compound.setString("modDisplayName", "Thaumic Tinkerer");
|
||||
FMLInterModComms.sendRuntimeMessage(LibMisc.MOD_ID, "VersionChecker", "addCurseCheck", compound);
|
||||
}
|
||||
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
ResearchHelper.initResearch();
|
||||
ThaumicTinkerer.registry.postInit();
|
||||
@@ -207,6 +192,41 @@ public class TTCommonProxy {
|
||||
ItemFocusDeflect.setupBlackList();
|
||||
}
|
||||
|
||||
public void serverStarting(FMLServerStartingEvent event) {
|
||||
MinecraftServer server = MinecraftServer.getServer();
|
||||
ICommandManager command = server.getCommandManager();
|
||||
ServerCommandManager manager = (ServerCommandManager) command;
|
||||
manager.registerCommand(new SetTendencyCommand());
|
||||
manager.registerCommand(new MaxResearchCommand());
|
||||
manager.registerCommand(new KamiUnlockedCommand());
|
||||
this.potionHandlerServer = new PotionEffectHandlerServer();
|
||||
MinecraftForge.EVENT_BUS.register(potionHandlerServer);
|
||||
FMLCommonHandler.instance().bus().register(potionHandlerServer);
|
||||
}
|
||||
|
||||
public void serverStopped(FMLServerStoppedEvent event) {
|
||||
if (this.potionHandlerServer != null) {
|
||||
MinecraftForge.EVENT_BUS.unregister(potionHandlerServer);
|
||||
FMLCommonHandler.instance().bus().unregister(potionHandlerServer);
|
||||
this.potionHandlerServer = null;
|
||||
}
|
||||
}
|
||||
|
||||
// spotless:off
|
||||
protected void registerPackets() {
|
||||
ThaumicTinkerer.netHandler.registerMessage(PacketSoulHearts.class, PacketSoulHearts.class, 142 + 0, Side.CLIENT);
|
||||
ThaumicTinkerer.netHandler.registerMessage(PacketToggleArmor.class, PacketToggleArmor.class, 142 + 1, Side.CLIENT);
|
||||
ThaumicTinkerer.netHandler.registerMessage(PacketToggleArmor.class, PacketToggleArmor.class, 142 + 2, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler.registerMessage(PacketWarpGateButton.class, PacketWarpGateButton.class, 142 + 3, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler.registerMessage(PacketWarpGateTeleport.class, PacketWarpGateTeleport.class, 142 + 4, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler.registerMessage(PacketEnchanterAddEnchant.class, PacketEnchanterAddEnchant.class, 142 + 5, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler.registerMessage(PacketEnchanterStartWorking.class, PacketEnchanterStartWorking.class, 142 + 6, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler.registerMessage(PacketMobMagnetButton.class, PacketMobMagnetButton.class, 142 + 7, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler.registerMessage(PacketTabletButton.class, PacketTabletButton.class, 142 + 8, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler.registerMessage(PacketPlacerButton.class, PacketPlacerButton.class, 142 + 9, Side.SERVER);
|
||||
}
|
||||
// spotless:on
|
||||
|
||||
@Optional.Method(modid = "EnderIO")
|
||||
protected void InitEnderIO() {
|
||||
EnderIO.registerPlanters();
|
||||
@@ -255,4 +275,25 @@ public class TTCommonProxy {
|
||||
public void shadowSparkle(World world, float x, float y, float z, int size) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
public String getMobDisplayName(EnumMobAspect aspect) {
|
||||
return aspect.getEntity(MinecraftServer.getServer().getEntityWorld()).getCommandSenderName();
|
||||
}
|
||||
|
||||
public static class NEIEventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void registerHandler(NEIRegisterHandlerInfosEvent event) {
|
||||
ItemStack necromancyTablet = new ItemStack(
|
||||
ThaumicTinkerer.registry.getFirstBlockFromClass(BlockSummon.class));
|
||||
event.registerHandlerInfo(
|
||||
new HandlerInfo.Builder(NEINecromancyHandler.class, LibMisc.MOD_NAME, LibMisc.MOD_ID).setHeight(88)
|
||||
.setDisplayStack(necromancyTablet).build());
|
||||
RecipeCatalysts.putRecipeCatalysts(
|
||||
NEINecromancyHandler.OVERLAY,
|
||||
Arrays.asList(
|
||||
new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemBloodSword.class)),
|
||||
necromancyTablet));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ package thaumic.tinkerer.common.item;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
@@ -88,8 +89,8 @@ public class ItemBloodSword extends ItemSword implements IRepairable, ITTinkerer
|
||||
}
|
||||
|
||||
@Override
|
||||
public Multimap getItemAttributeModifiers() {
|
||||
Multimap<Object, Object> multimap = HashMultimap.create();
|
||||
public Multimap<String, AttributeModifier> getItemAttributeModifiers() {
|
||||
Multimap<String, AttributeModifier> multimap = HashMultimap.create();
|
||||
multimap.put(
|
||||
SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(),
|
||||
new AttributeModifier(field_111210_e, "Weapon modifier", DAMAGE, 0));
|
||||
@@ -183,24 +184,21 @@ public class ItemBloodSword extends ItemSword implements IRepairable, ITTinkerer
|
||||
|
||||
@SubscribeEvent
|
||||
public void onDrops(LivingDropsEvent event) {
|
||||
if (event.source.damageType.equals("player")) {
|
||||
|
||||
EntityPlayer player = (EntityPlayer) event.source.getEntity();
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if (stack != null && stack.getItem() == ItemBloodSword.this
|
||||
&& stack.stackTagCompound != null
|
||||
&& stack.stackTagCompound.getInteger("Activated") == 1) {
|
||||
Aspect[] aspects = EnumMobAspect.getAspectsForEntity(event.entity);
|
||||
// ScanResult sr=new ScanResult((byte)2,0,0,event.entity,"");
|
||||
// AspectList as=ScanManager.getScanAspects(sr,event.entity.worldObj);
|
||||
// if(as!=null && as.size()!=0){
|
||||
if (aspects != null) {
|
||||
event.drops.removeAll(event.drops);
|
||||
// for(Aspect a:as.getAspects()){
|
||||
for (Aspect a : aspects) {
|
||||
addDrops(event, ItemMobAspect.getStackFromAspect(a));
|
||||
}
|
||||
}
|
||||
if (!event.source.damageType.equals("player") || !(event.entity instanceof EntityLiving entity)) {
|
||||
return;
|
||||
}
|
||||
EntityPlayer player = (EntityPlayer) event.source.getEntity();
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if (stack == null || stack.getItem() != ItemBloodSword.this
|
||||
|| stack.stackTagCompound == null
|
||||
|| stack.stackTagCompound.getInteger("Activated") != 1) {
|
||||
return;
|
||||
}
|
||||
Aspect[] aspects = EnumMobAspect.getAspectsForEntity(entity);
|
||||
if (aspects != null) {
|
||||
event.drops.clear();
|
||||
for (Aspect a : aspects) {
|
||||
addDrops(event, ItemMobAspect.getStackFromAspect(a));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -214,8 +212,7 @@ public class ItemBloodSword extends ItemSword implements IRepairable, ITTinkerer
|
||||
boolean handle = handleNext == 0;
|
||||
if (!handle) handleNext--;
|
||||
|
||||
if (event.entityLiving instanceof EntityPlayer && handle) {
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
if (event.entityLiving instanceof EntityPlayer player && handle) {
|
||||
ItemStack itemInUse = player.itemInUse;
|
||||
if (itemInUse != null && itemInUse.getItem() == ItemBloodSword.this) {
|
||||
|
||||
@@ -227,8 +224,7 @@ public class ItemBloodSword extends ItemSword implements IRepairable, ITTinkerer
|
||||
|
||||
if (handle) {
|
||||
Entity source = event.source.getSourceOfDamage();
|
||||
if (source != null && source instanceof EntityLivingBase) {
|
||||
EntityLivingBase attacker = (EntityLivingBase) source;
|
||||
if (source instanceof EntityLivingBase attacker) {
|
||||
ItemStack itemInUse = attacker.getHeldItem();
|
||||
if (itemInUse != null && itemInUse.getItem() == ItemBloodSword.this)
|
||||
attacker.attackEntityFrom(DamageSource.magic, 2);
|
||||
|
||||
@@ -3,15 +3,14 @@ package thaumic.tinkerer.common.item;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
import thaumic.tinkerer.common.core.helper.EnumMobAspect;
|
||||
import thaumic.tinkerer.common.core.helper.ItemNBTHelper;
|
||||
import thaumic.tinkerer.common.lib.LibItemNames;
|
||||
import thaumic.tinkerer.common.registry.ItemBase;
|
||||
import thaumic.tinkerer.common.registry.ThaumicTinkererRecipe;
|
||||
import thaumic.tinkerer.common.research.IRegisterableResearch;
|
||||
|
||||
/**
|
||||
@@ -23,10 +22,8 @@ public class ItemMobDisplay extends ItemBase {
|
||||
|
||||
public ItemMobDisplay() {
|
||||
super();
|
||||
setHasSubtypes(true); // This allows the item to be marked as a metadata item.
|
||||
setMaxDamage(0); // This makes it so your item doesn't have the damage bar at the bottom of its icon, when
|
||||
// "damaged"
|
||||
// similar to the Tools.
|
||||
setHasSubtypes(true);
|
||||
setMaxDamage(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -34,37 +31,24 @@ public class ItemMobDisplay extends ItemBase {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public EnumMobAspect getEntityType(ItemStack stack) {
|
||||
return EnumMobAspect.getMobAspectForType(ItemNBTHelper.getString(stack, TAG_TYPE, ""));
|
||||
return EnumMobAspect.get(ItemNBTHelper.getString(stack, TAG_TYPE, ""));
|
||||
}
|
||||
|
||||
public void setEntityType(ItemStack stack, String type) {
|
||||
ItemNBTHelper.setString(stack, TAG_TYPE, type);
|
||||
public void setEntityType(ItemStack stack, EnumMobAspect type) {
|
||||
ItemNBTHelper.setString(stack, TAG_TYPE, type.name());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item par1Item, CreativeTabs par2CreativeTabs, List list) {
|
||||
super.getSubItems(par1Item, par2CreativeTabs, list);
|
||||
public void getSubItems(Item par1Item, CreativeTabs par2CreativeTabs, List<ItemStack> list) {
|
||||
for (EnumMobAspect aspect : EnumMobAspect.values()) {
|
||||
Class aspClass = aspect.getEntityClass();
|
||||
String name = (String) EntityList.classToStringMapping.get(aspClass);
|
||||
ItemStack item = new ItemStack(this);
|
||||
this.setEntityType(item, name);
|
||||
this.setEntityType(item, aspect);
|
||||
list.add(item);
|
||||
}
|
||||
}
|
||||
@@ -73,4 +57,13 @@ public class ItemMobDisplay extends ItemBase {
|
||||
public String getItemName() {
|
||||
return LibItemNames.MOB_DISPLAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
String mob = ItemNBTHelper.getString(stack, TAG_TYPE, "");
|
||||
if (mob == null || mob.isEmpty()) return super.getItemStackDisplayName(stack);
|
||||
EnumMobAspect aspect = EnumMobAspect.get(mob);
|
||||
if (aspect == null) return super.getItemStackDisplayName(stack);
|
||||
return ThaumicTinkerer.proxy.getMobDisplayName(aspect);
|
||||
}
|
||||
}
|
||||
@@ -127,7 +127,7 @@ public class ItemGemLegs extends ItemIchorclothArmorAdv {
|
||||
new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemKamiResource.class)),
|
||||
new ItemStack(ConfigItems.itemFocusPrimal),
|
||||
new ItemStack(ConfigItems.itemThaumonomicon),
|
||||
new ItemStack(Items.golden_chestplate),
|
||||
new ItemStack(Items.golden_leggings),
|
||||
new ItemStack(Items.potionitem, 1, 8195),
|
||||
new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemFocusSmelt.class)),
|
||||
new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemBrightNitor.class)),
|
||||
|
||||
@@ -105,15 +105,20 @@ public class ItemIchorPickAdv extends ItemIchorPick implements IAdvancedTool {
|
||||
ForgeDirection direction = ForgeDirection.getOrientation(block.sideHit);
|
||||
int fortune = EnchantmentHelper.getFortuneModifier(player);
|
||||
boolean silk = EnchantmentHelper.getSilkTouchModifier(player);
|
||||
if (ConfigHandler.bedrockDimensionID != 0 && blk == Blocks.bedrock
|
||||
&& ((world.provider.isSurfaceWorld() && y < 5)
|
||||
|| (y > 253 && world.provider instanceof WorldProviderBedrock))) {
|
||||
world.setBlock(x, y, z, ThaumicTinkerer.registry.getFirstBlockFromClass(BlockBedrockPortal.class));
|
||||
}
|
||||
if (ConfigHandler.bedrockDimensionID != 0 && blk == Blocks.bedrock
|
||||
&& (y <= 253 && world.provider instanceof WorldProviderBedrock)) {
|
||||
world.setBlock(x, y, z, Blocks.air);
|
||||
|
||||
if (player.isSneaking() && ConfigHandler.bedrockDimensionID != 0 && blk == Blocks.bedrock) {
|
||||
// Bedrock -> Portal (Overworld low Y OR Bedrock dimension high Y)
|
||||
if ((world.provider.isSurfaceWorld() && y < 5)
|
||||
|| (y > 253 && world.provider instanceof WorldProviderBedrock)) {
|
||||
world.setBlock(x, y, z, ThaumicTinkerer.registry.getFirstBlockFromClass(BlockBedrockPortal.class));
|
||||
}
|
||||
|
||||
// Bedrock -> Air (Bedrock dimension normal Y)
|
||||
if (y <= 253 && world.provider instanceof WorldProviderBedrock) {
|
||||
world.setBlock(x, y, z, Blocks.air);
|
||||
}
|
||||
}
|
||||
|
||||
switch (ToolHandler.getMode(stack)) {
|
||||
case 0:
|
||||
break;
|
||||
@@ -122,22 +127,24 @@ public class ItemIchorPickAdv extends ItemIchorPick implements IAdvancedTool {
|
||||
boolean doY = direction.offsetY == 0;
|
||||
boolean doZ = direction.offsetZ == 0;
|
||||
|
||||
ToolHandler.removeBlocksInIteration(
|
||||
player,
|
||||
world,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
doX ? -2 : 0,
|
||||
doY ? -1 : 0,
|
||||
doZ ? -2 : 0,
|
||||
doX ? 3 : 1,
|
||||
doY ? 4 : 1,
|
||||
doZ ? 3 : 1,
|
||||
null,
|
||||
ToolHandler.materialsPick,
|
||||
silk,
|
||||
fortune);
|
||||
if (!player.isSneaking()) {
|
||||
ToolHandler.removeBlocksInIteration(
|
||||
player,
|
||||
world,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
doX ? -2 : 0,
|
||||
doY ? -1 : 0,
|
||||
doZ ? -2 : 0,
|
||||
doX ? 3 : 1,
|
||||
doY ? 4 : 1,
|
||||
doZ ? 3 : 1,
|
||||
null,
|
||||
ToolHandler.materialsPick,
|
||||
silk,
|
||||
fortune);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -146,22 +153,24 @@ public class ItemIchorPickAdv extends ItemIchorPick implements IAdvancedTool {
|
||||
int yo = -direction.offsetY;
|
||||
int zo = -direction.offsetZ;
|
||||
|
||||
ToolHandler.removeBlocksInIteration(
|
||||
player,
|
||||
world,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
xo >= 0 ? 0 : -10,
|
||||
yo >= 0 ? 0 : -10,
|
||||
zo >= 0 ? 0 : -10,
|
||||
xo > 0 ? 10 : 1,
|
||||
yo > 0 ? 10 : 1,
|
||||
zo > 0 ? 10 : 1,
|
||||
null,
|
||||
ToolHandler.materialsPick,
|
||||
silk,
|
||||
fortune);
|
||||
if (!player.isSneaking()) {
|
||||
ToolHandler.removeBlocksInIteration(
|
||||
player,
|
||||
world,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
xo >= 0 ? 0 : -10,
|
||||
yo >= 0 ? 0 : -10,
|
||||
zo >= 0 ? 0 : -10,
|
||||
xo > 0 ? 10 : 1,
|
||||
yo > 0 ? 10 : 1,
|
||||
zo > 0 ? 10 : 1,
|
||||
null,
|
||||
ToolHandler.materialsPick,
|
||||
silk,
|
||||
fortune);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,9 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.item.kami.tool;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -40,11 +42,14 @@ import thaumic.tinkerer.common.dim.WorldProviderBedrock;
|
||||
|
||||
public final class ToolHandler {
|
||||
|
||||
public static Material[] materialsPick = new Material[] { Material.rock, Material.iron, Material.ice,
|
||||
Material.glass, Material.piston, Material.anvil };
|
||||
public static Material[] materialsShovel = new Material[] { Material.grass, Material.ground, Material.sand,
|
||||
public final static Material[] materialsShovel = new Material[] { Material.grass, Material.ground, Material.sand,
|
||||
Material.snow, Material.craftedSnow, Material.clay };
|
||||
public static Material[] materialsAxe = new Material[] { Material.coral, Material.leaves, Material.plants,
|
||||
public final static Material[] materialsPick = Stream.concat(
|
||||
Arrays.stream(
|
||||
new Material[] { Material.rock, Material.iron, Material.ice, Material.glass, Material.piston,
|
||||
Material.anvil }),
|
||||
Arrays.stream(materialsShovel)).toArray(Material[]::new);
|
||||
public final static Material[] materialsAxe = new Material[] { Material.coral, Material.leaves, Material.plants,
|
||||
Material.wood };
|
||||
|
||||
public static int getMode(ItemStack tool) {
|
||||
@@ -74,7 +79,6 @@ public final class ToolHandler {
|
||||
for (int x1 = xs; x1 < xe; x1++) {
|
||||
for (int y1 = ys; y1 < ye; y1++) {
|
||||
for (int z1 = zs; z1 < ze; z1++) {
|
||||
if (x == x1 + x && y == y1 + y && z == z1 + z) continue;
|
||||
Block lock2 = world.getBlock(x1 + x, y1 + y, z1 + z);
|
||||
|
||||
breakExtraBlock(player.worldObj, x1 + x, y1 + y, z1 + z, player, x, y, z, materialsListing);
|
||||
@@ -102,6 +106,15 @@ public final class ToolHandler {
|
||||
|
||||
// only effective materials
|
||||
if (!block.canHarvestBlock(player, meta) || !isRightMaterial(block.getMaterial(), materialsListing)) return;
|
||||
|
||||
if (block == Blocks.bedrock) {
|
||||
// Ignore top & bottom 2 bedrock layers (Bedrock dimension only)
|
||||
if (y > 253 && world.provider instanceof WorldProviderBedrock) return;
|
||||
|
||||
// Ignore bedrock in all other dimensions
|
||||
if (!(world.provider instanceof WorldProviderBedrock)) return;
|
||||
}
|
||||
|
||||
Block refBlock = world.getBlock(refX, refY, refZ);
|
||||
float refStrength = ForgeHooks.blockStrength(refBlock, player, world, refX, refY, refZ);
|
||||
float strength = ForgeHooks.blockStrength(block, player, world, x, y, z);
|
||||
|
||||
@@ -15,9 +15,7 @@ import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import thaumic.tinkerer.common.core.handler.ConfigHandler;
|
||||
|
||||
public final class ModPotions {
|
||||
@@ -28,8 +26,6 @@ public final class ModPotions {
|
||||
public static Potion potionAir;
|
||||
|
||||
public static void initPotions() {
|
||||
MinecraftForge.EVENT_BUS.register(new PotionEffectHandler());
|
||||
FMLCommonHandler.instance().bus().register(new PotionEffectHandler());
|
||||
|
||||
// Code based on potion code from WayOfTime
|
||||
Potion[] potionTypes = null;
|
||||
|
||||
@@ -1,193 +0,0 @@
|
||||
package thaumic.tinkerer.common.potion;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
import thaumic.tinkerer.common.block.BlockForcefield;
|
||||
|
||||
/**
|
||||
* Created by pixlepix on 4/19/14.
|
||||
*/
|
||||
public class PotionEffectHandler {
|
||||
|
||||
public static HashMap<Entity, Long> airPotionHitClient = new HashMap<>();
|
||||
public static HashMap<Entity, Long> airPotionHitServer = new HashMap<>();
|
||||
public static HashMap<Entity, Long> firePotionHitClient = new HashMap<>();
|
||||
public static HashMap<Entity, Long> firePotionHitServer = new HashMap<>();
|
||||
|
||||
@SubscribeEvent
|
||||
public void onLivingHurt(LivingAttackEvent e) {
|
||||
if (e.source.getSourceOfDamage() instanceof EntityPlayer) {
|
||||
EntityPlayer p = (EntityPlayer) e.source.getSourceOfDamage();
|
||||
if (p.isPotionActive(ModPotions.potionAir)) {
|
||||
if (p.worldObj.isRemote) {
|
||||
airPotionHitClient.put(e.entity, e.entity.worldObj.getTotalWorldTime());
|
||||
} else {
|
||||
airPotionHitServer.put(e.entity, e.entity.worldObj.getTotalWorldTime());
|
||||
}
|
||||
}
|
||||
if (p.isPotionActive(ModPotions.potionFire)) {
|
||||
if (p.worldObj.isRemote) {
|
||||
firePotionHitClient.put(e.entity, e.entity.worldObj.getTotalWorldTime());
|
||||
} else {
|
||||
firePotionHitServer.put(e.entity, e.entity.worldObj.getTotalWorldTime());
|
||||
}
|
||||
}
|
||||
if (p.isPotionActive(ModPotions.potionEarth)) {
|
||||
boolean xAxis = Math.abs(e.entity.posZ - p.posZ) < Math.abs(e.entity.posX - p.posX);
|
||||
int centerX = (int) ((e.entity.posX + p.posX) / 2);
|
||||
|
||||
int centerY = (int) (p.posY + 2);
|
||||
int centerZ = (int) ((e.entity.posZ + p.posZ) / 2);
|
||||
|
||||
for (int i = -2; i < 3; i++) {
|
||||
for (int j = -2; j < 3; j++) {
|
||||
if (xAxis) {
|
||||
if (!p.worldObj.isRemote) {
|
||||
if (p.worldObj.isAirBlock(centerX, centerY + i, centerZ + j)) {
|
||||
p.worldObj.setBlock(
|
||||
centerX,
|
||||
centerY + i,
|
||||
centerZ + j,
|
||||
ThaumicTinkerer.registry.getFirstBlockFromClass(BlockForcefield.class));
|
||||
}
|
||||
} else {
|
||||
ThaumicTinkerer.tcProxy
|
||||
.blockSparkle(p.worldObj, centerX, centerY + i, centerZ + j, 100, 100);
|
||||
}
|
||||
|
||||
} else {
|
||||
if (!p.worldObj.isRemote) {
|
||||
if (p.worldObj.isAirBlock(centerX + j, centerY + i, centerZ)) {
|
||||
p.worldObj.setBlock(
|
||||
centerX + j,
|
||||
centerY + i,
|
||||
centerZ,
|
||||
ThaumicTinkerer.registry.getFirstBlockFromClass(BlockForcefield.class));
|
||||
}
|
||||
} else {
|
||||
ThaumicTinkerer.tcProxy
|
||||
.blockSparkle(p.worldObj, centerX + j, centerY + i, centerZ, 100, 100);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerTick(TickEvent.PlayerTickEvent e) {
|
||||
if (e.player.isPotionActive(ModPotions.potionWater)) {
|
||||
for (int x = (int) (e.player.posX - 2); x < e.player.posX + 2; x++) {
|
||||
for (int y = (int) (e.player.posY - 2); y < e.player.posY + 2; y++) {
|
||||
for (int z = (int) (e.player.posZ - 2); z < e.player.posZ + 2; z++) {
|
||||
if (e.player.worldObj.getBlock(x, y, z) == Blocks.lava
|
||||
|| e.player.worldObj.getBlock(x, y, z) == Blocks.flowing_lava) {
|
||||
e.player.worldObj.setBlock(x, y, z, Blocks.obsidian);
|
||||
if (e.player.worldObj.isRemote) {
|
||||
ThaumicTinkerer.tcProxy.burst(e.player.worldObj, x + .5, y + .5, z + .5, 1.2F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTickClient(TickEvent.ClientTickEvent e) {
|
||||
|
||||
Iterator<Entity> iter = airPotionHitClient.keySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Entity target = iter.next();
|
||||
if (target.isEntityAlive()) {
|
||||
if (target.worldObj.getTotalWorldTime() % 5 == 0) {
|
||||
ThaumicTinkerer.tcProxy.burst(target.worldObj, target.posX, target.posY, target.posZ, .5F);
|
||||
}
|
||||
}
|
||||
if (target.worldObj.getTotalWorldTime() > airPotionHitClient.get(target) + 20) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
|
||||
iter = firePotionHitClient.keySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Entity target = iter.next();
|
||||
if (target.isEntityAlive()) {
|
||||
if (target.worldObj.getTotalWorldTime() % 5 == 0) {
|
||||
Random rand = new Random();
|
||||
|
||||
for (int i = 0; i < 30; i++) {
|
||||
double theta = rand.nextFloat() * 2 * Math.PI;
|
||||
|
||||
double phi = rand.nextFloat() * 2 * Math.PI;
|
||||
double r = 2.5;
|
||||
|
||||
double x = r * Math.sin(theta) * Math.cos(phi);
|
||||
|
||||
double y = r * Math.sin(theta) * Math.sin(phi);
|
||||
|
||||
double z = r * Math.cos(theta);
|
||||
|
||||
ThaumicTinkerer.tcProxy.wispFX2(
|
||||
target.worldObj,
|
||||
target.posX + x,
|
||||
target.posY + y + 1,
|
||||
target.posZ + z,
|
||||
.1F,
|
||||
4,
|
||||
true,
|
||||
true,
|
||||
1F);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (target.worldObj.getTotalWorldTime() > firePotionHitClient.get(target) + 6000) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTickServer(TickEvent.ServerTickEvent e) {
|
||||
|
||||
Iterator<Entity> iter = airPotionHitServer.keySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Entity target = iter.next();
|
||||
if (target.isEntityAlive()) {
|
||||
if (target.worldObj.getTotalWorldTime() % 5 == 0) {
|
||||
Random rand = new Random();
|
||||
target.setVelocity(rand.nextFloat() - .5, rand.nextFloat(), rand.nextFloat() - .5);
|
||||
}
|
||||
}
|
||||
if (target.worldObj.getTotalWorldTime() > airPotionHitServer.get(target) + 20) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
|
||||
// Fire Potion
|
||||
iter = firePotionHitServer.keySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Entity target = iter.next();
|
||||
if (target.isEntityAlive()) {
|
||||
if (target.worldObj.getTotalWorldTime() % 5 == 0) {
|
||||
target.setFire(6);
|
||||
}
|
||||
}
|
||||
if (target.worldObj.getTotalWorldTime() > firePotionHitServer.get(target) + 6000) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
package thaumic.tinkerer.common.potion;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
|
||||
public final class PotionEffectHandlerClient {
|
||||
|
||||
private final HashMap<Entity, Long> airPotionHitClient = new HashMap<>();
|
||||
private final HashMap<Entity, Long> firePotionHitClient = new HashMap<>();
|
||||
|
||||
@SubscribeEvent
|
||||
public void onLivingHurt(LivingAttackEvent e) {
|
||||
if (e.source.getSourceOfDamage() instanceof EntityPlayer p && p.worldObj.isRemote) {
|
||||
if (p.isPotionActive(ModPotions.potionAir)) {
|
||||
airPotionHitClient.put(e.entity, e.entity.worldObj.getTotalWorldTime());
|
||||
}
|
||||
if (p.isPotionActive(ModPotions.potionFire)) {
|
||||
firePotionHitClient.put(e.entity, e.entity.worldObj.getTotalWorldTime());
|
||||
}
|
||||
if (p.isPotionActive(ModPotions.potionEarth)) {
|
||||
boolean xAxis = Math.abs(e.entity.posZ - p.posZ) < Math.abs(e.entity.posX - p.posX);
|
||||
int centerX = (int) ((e.entity.posX + p.posX) / 2);
|
||||
|
||||
int centerY = (int) (p.posY + 2);
|
||||
int centerZ = (int) ((e.entity.posZ + p.posZ) / 2);
|
||||
|
||||
for (int i = -2; i < 3; i++) {
|
||||
for (int j = -2; j < 3; j++) {
|
||||
if (xAxis) {
|
||||
ThaumicTinkerer.tcProxy
|
||||
.blockSparkle(p.worldObj, centerX, centerY + i, centerZ + j, 100, 100);
|
||||
} else {
|
||||
ThaumicTinkerer.tcProxy
|
||||
.blockSparkle(p.worldObj, centerX + j, centerY + i, centerZ, 100, 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerTick(TickEvent.PlayerTickEvent e) {
|
||||
if (e.side == Side.CLIENT && e.player.isPotionActive(ModPotions.potionWater)) {
|
||||
for (int x = (int) (e.player.posX - 2); x < e.player.posX + 2; x++) {
|
||||
for (int y = (int) (e.player.posY - 2); y < e.player.posY + 2; y++) {
|
||||
for (int z = (int) (e.player.posZ - 2); z < e.player.posZ + 2; z++) {
|
||||
if (e.player.worldObj.getBlock(x, y, z) == Blocks.lava
|
||||
|| e.player.worldObj.getBlock(x, y, z) == Blocks.flowing_lava) {
|
||||
ThaumicTinkerer.tcProxy.burst(e.player.worldObj, x + .5, y + .5, z + .5, 1.2F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTickClient(TickEvent.ClientTickEvent e) {
|
||||
|
||||
Iterator<Entity> iter = airPotionHitClient.keySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Entity target = iter.next();
|
||||
if (target.isEntityAlive()) {
|
||||
if (target.worldObj.getTotalWorldTime() % 5 == 0) {
|
||||
ThaumicTinkerer.tcProxy.burst(target.worldObj, target.posX, target.posY, target.posZ, .5F);
|
||||
}
|
||||
}
|
||||
if (target.worldObj.getTotalWorldTime() > airPotionHitClient.get(target) + 20) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
|
||||
iter = firePotionHitClient.keySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Entity target = iter.next();
|
||||
if (target.isEntityAlive()) {
|
||||
if (target.worldObj.getTotalWorldTime() % 5 == 0) {
|
||||
Random rand = new Random();
|
||||
|
||||
for (int i = 0; i < 30; i++) {
|
||||
double theta = rand.nextFloat() * 2 * Math.PI;
|
||||
|
||||
double phi = rand.nextFloat() * 2 * Math.PI;
|
||||
double r = 2.5;
|
||||
|
||||
double x = r * Math.sin(theta) * Math.cos(phi);
|
||||
|
||||
double y = r * Math.sin(theta) * Math.sin(phi);
|
||||
|
||||
double z = r * Math.cos(theta);
|
||||
|
||||
ThaumicTinkerer.tcProxy.wispFX2(
|
||||
target.worldObj,
|
||||
target.posX + x,
|
||||
target.posY + y + 1,
|
||||
target.posZ + z,
|
||||
.1F,
|
||||
4,
|
||||
true,
|
||||
true,
|
||||
1F);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (target.worldObj.getTotalWorldTime() > firePotionHitClient.get(target) + 6000) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package thaumic.tinkerer.common.potion;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
import thaumic.tinkerer.common.block.BlockForcefield;
|
||||
|
||||
/**
|
||||
* Created by pixlepix on 4/19/14.
|
||||
*/
|
||||
public final class PotionEffectHandlerServer {
|
||||
|
||||
private final HashMap<Entity, Long> airPotionHitServer = new HashMap<>();
|
||||
private final HashMap<Entity, Long> firePotionHitServer = new HashMap<>();
|
||||
|
||||
@SubscribeEvent
|
||||
public void onLivingHurt(LivingAttackEvent e) {
|
||||
if (e.source.getSourceOfDamage() instanceof EntityPlayer p && !p.worldObj.isRemote) {
|
||||
if (p.isPotionActive(ModPotions.potionAir)) {
|
||||
airPotionHitServer.put(e.entity, e.entity.worldObj.getTotalWorldTime());
|
||||
}
|
||||
if (p.isPotionActive(ModPotions.potionFire)) {
|
||||
firePotionHitServer.put(e.entity, e.entity.worldObj.getTotalWorldTime());
|
||||
}
|
||||
if (p.isPotionActive(ModPotions.potionEarth)) {
|
||||
boolean xAxis = Math.abs(e.entity.posZ - p.posZ) < Math.abs(e.entity.posX - p.posX);
|
||||
int centerX = (int) ((e.entity.posX + p.posX) / 2);
|
||||
|
||||
int centerY = (int) (p.posY + 2);
|
||||
int centerZ = (int) ((e.entity.posZ + p.posZ) / 2);
|
||||
|
||||
for (int i = -2; i < 3; i++) {
|
||||
for (int j = -2; j < 3; j++) {
|
||||
if (xAxis) {
|
||||
if (p.worldObj.isAirBlock(centerX, centerY + i, centerZ + j)) {
|
||||
p.worldObj.setBlock(
|
||||
centerX,
|
||||
centerY + i,
|
||||
centerZ + j,
|
||||
ThaumicTinkerer.registry.getFirstBlockFromClass(BlockForcefield.class));
|
||||
}
|
||||
} else {
|
||||
if (p.worldObj.isAirBlock(centerX + j, centerY + i, centerZ)) {
|
||||
p.worldObj.setBlock(
|
||||
centerX + j,
|
||||
centerY + i,
|
||||
centerZ,
|
||||
ThaumicTinkerer.registry.getFirstBlockFromClass(BlockForcefield.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerTick(TickEvent.PlayerTickEvent e) {
|
||||
if (e.side == Side.SERVER && e.player.isPotionActive(ModPotions.potionWater)) {
|
||||
for (int x = (int) (e.player.posX - 2); x < e.player.posX + 2; x++) {
|
||||
for (int y = (int) (e.player.posY - 2); y < e.player.posY + 2; y++) {
|
||||
for (int z = (int) (e.player.posZ - 2); z < e.player.posZ + 2; z++) {
|
||||
if (e.player.worldObj.getBlock(x, y, z) == Blocks.lava
|
||||
|| e.player.worldObj.getBlock(x, y, z) == Blocks.flowing_lava) {
|
||||
e.player.worldObj.setBlock(x, y, z, Blocks.obsidian);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTickServer(TickEvent.ServerTickEvent e) {
|
||||
|
||||
Iterator<Entity> iter = airPotionHitServer.keySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Entity target = iter.next();
|
||||
if (target.isEntityAlive()) {
|
||||
if (target.worldObj.getTotalWorldTime() % 5 == 0) {
|
||||
Random rand = new Random();
|
||||
target.setVelocity(rand.nextFloat() - .5, rand.nextFloat(), rand.nextFloat() - .5);
|
||||
}
|
||||
}
|
||||
if (target.worldObj.getTotalWorldTime() > airPotionHitServer.get(target) + 20) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
|
||||
// Fire Potion
|
||||
iter = firePotionHitServer.keySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Entity target = iter.next();
|
||||
if (target.isEntityAlive()) {
|
||||
if (target.worldObj.getTotalWorldTime() % 5 == 0) {
|
||||
target.setFire(6);
|
||||
}
|
||||
}
|
||||
if (target.worldObj.getTotalWorldTime() > firePotionHitServer.get(target) + 6000) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -107,6 +107,7 @@ item.infusedPotion.Ignis.name=Potion of Ignis
|
||||
item.infusedPotion.Terra.name=Potion of Terra
|
||||
item.infusedPotion.Aqua.name=Potion of Aqua
|
||||
item.infusedGrain.name=Imbued Grain
|
||||
item.mobDisplay.name=Unknown Mob
|
||||
# KAMI ITEM NAMES
|
||||
item.kamiResource.name=Kami Resource
|
||||
item.ichor.name=Ichor
|
||||
|
||||
Reference in new issue
Block a user