mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-17 02:45:13 +00:00
Compiles. Update JEI.
This commit is contained in:
1 parent
0af2d25a71
commit
d37518c9f4
85 files changed
+660
-483
No files matched your search
@@ -13,8 +13,9 @@ package vazkii.botania.api.boss;
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.entity.boss.IBossDisplayData;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.BossInfo;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -26,7 +27,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
* Alternatively, you can check if botania is loaded and use the vanilla one
|
||||
* if that's not the case.
|
||||
*/
|
||||
public interface IBotaniaBoss extends IBossDisplayData {
|
||||
public interface IBotaniaBoss {
|
||||
|
||||
/**
|
||||
* The ResourceLocation to bind for this boss's boss bar.
|
||||
@@ -56,4 +57,8 @@ public interface IBotaniaBoss extends IBossDisplayData {
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void bossBarRenderCallback(ScaledResolution res, int x, int y);
|
||||
|
||||
public BossInfo getBossInfo();
|
||||
|
||||
public EntityLivingBase getEntity();
|
||||
}
|
||||
@@ -10,7 +10,6 @@
|
||||
*/
|
||||
package vazkii.botania.api.lexicon.multiblock.component;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
@@ -26,8 +25,8 @@ public class AnyComponent extends MultiblockComponent {
|
||||
|
||||
@Override
|
||||
public boolean matches(World world, BlockPos pos) {
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
return !block.isAir(world, pos) && block.getCollisionBoundingBox(world, pos, world.getBlockState(pos)) != null;
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
return !state.getBlock().isAir(state, world, pos) && state.getCollisionBoundingBox(world, pos) != null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,6 +11,7 @@
|
||||
package vazkii.botania.api.wiki;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -49,15 +50,12 @@ public class SimpleWikiProvider implements IWikiProvider {
|
||||
@Override
|
||||
public String getBlockName(World world, RayTraceResult pos, EntityPlayer player) {
|
||||
BlockPos bPos = pos.getBlockPos();
|
||||
IBlockState state = world.getBlockState(bPos);
|
||||
|
||||
Block block = world.getBlockState(bPos).getBlock();
|
||||
if(block == null)
|
||||
return null;
|
||||
|
||||
ItemStack stack = block.getPickBlock(pos, world, bPos, player);
|
||||
ItemStack stack = state.getBlock().getPickBlock(state, pos, world, bPos, player);
|
||||
|
||||
if(stack == null || stack.getItem() == null)
|
||||
stack = new ItemStack(block, 1, block.getDamageValue(world, bPos));
|
||||
stack = new ItemStack(state.getBlock(), 1, state.getBlock().damageDropped(state));
|
||||
|
||||
if(stack.getItem() == null)
|
||||
return null;
|
||||
|
||||
@@ -17,6 +17,8 @@ import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
@@ -37,7 +39,7 @@ public final class BaubleRenderHandler implements LayerRenderer<EntityPlayer> {
|
||||
|
||||
@Override
|
||||
public void doRenderLayer(EntityPlayer player, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) {
|
||||
if(!ConfigHandler.renderBaubles || player.getActivePotionEffect(Potion.invisibility) != null)
|
||||
if(!ConfigHandler.renderBaubles || player.getActivePotionEffect(MobEffects.invisibility) != null)
|
||||
return;
|
||||
|
||||
InventoryBaubles inv = PlayerHandler.getPlayerBaubles(player);
|
||||
@@ -108,7 +110,7 @@ public final class BaubleRenderHandler implements LayerRenderer<EntityPlayer> {
|
||||
GlStateManager.pushMatrix();
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
Helper.rotateIfSneaking(player);
|
||||
boolean armor = player.getCurrentArmor(1) != null;
|
||||
boolean armor = player.getItemStackFromSlot(EntityEquipmentSlot.LEGS) != null;
|
||||
GlStateManager.rotate(90, 0, 1, 0);
|
||||
GlStateManager.rotate(90, 1, 0, 0);
|
||||
|
||||
@@ -124,7 +126,7 @@ public final class BaubleRenderHandler implements LayerRenderer<EntityPlayer> {
|
||||
int lightmapX = light % 65536;
|
||||
int lightmapY = light / 65536;
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY);
|
||||
Minecraft.getMinecraft().getRenderItem().renderItem(stack, ItemCameraTransforms.TransformType.THIRD_PERSON);
|
||||
Minecraft.getMinecraft().getRenderItem().renderItem(stack, ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND); // todo 1.9
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
if(renderedOne)
|
||||
|
||||
@@ -48,13 +48,13 @@ public final class BossBarHandler {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Rectangle bgRect = currentBoss.getBossBarTextureRect();
|
||||
Rectangle fgRect = currentBoss.getBossBarHPTextureRect();
|
||||
String name = currentBoss.getDisplayName().getFormattedText();
|
||||
String name = currentBoss.getEntity().getDisplayName().getFormattedText();
|
||||
int c = res.getScaledWidth() / 2;
|
||||
int x = c - bgRect.width / 2;
|
||||
int y = 20;
|
||||
int xf = x + (bgRect.width - fgRect.width) / 2;
|
||||
int yf = y + (bgRect.height - fgRect.height) / 2;
|
||||
int fw = (int) ((double) fgRect.width * (currentBoss.getHealth() / currentBoss.getMaxHealth()));
|
||||
int fw = (int) ((double) fgRect.width * (currentBoss.getEntity().getHealth() / currentBoss.getEntity().getMaxHealth()));
|
||||
int tx = c - mc.fontRendererObj.getStringWidth(name) / 2;
|
||||
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
|
||||
@@ -13,6 +13,8 @@ package vazkii.botania.client.core.proxy;
|
||||
import java.awt.Desktop;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URI;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.Month;
|
||||
@@ -276,13 +278,17 @@ public class ClientProxy extends CommonProxy {
|
||||
Map<String, RenderPlayer> skinMap = Minecraft.getMinecraft().getRenderManager().getSkinMap();
|
||||
RenderPlayer render;
|
||||
|
||||
render = skinMap.get("default");
|
||||
render.addLayer(new ContributorFancinessHandler());
|
||||
render.addLayer(new BaubleRenderHandler());
|
||||
try { // todo 1.9 get Forge to AT this back -.-
|
||||
Method m = ReflectionHelper.findMethod(RenderPlayer.class, null, LibObfuscation.ADD_LAYER);
|
||||
|
||||
render = skinMap.get("slim");
|
||||
render.addLayer(new ContributorFancinessHandler());
|
||||
render.addLayer(new BaubleRenderHandler());
|
||||
render = skinMap.get("default");
|
||||
m.invoke(render, new ContributorFancinessHandler());
|
||||
m.invoke(render, new BaubleRenderHandler());
|
||||
|
||||
render = skinMap.get("slim");
|
||||
m.invoke(render, new ContributorFancinessHandler());
|
||||
m.invoke(render, new BaubleRenderHandler());
|
||||
} catch (ReflectiveOperationException ignored) {}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -153,10 +153,10 @@ public class FXSparkle extends EntityFX {
|
||||
ySpeed *= 0.908000001907348633D;
|
||||
zSpeed *= 0.908000001907348633D;
|
||||
|
||||
if (onGround) {
|
||||
/*if (onGround) { todo 1.9
|
||||
xSpeed *= 0.69999998807907104D;
|
||||
zSpeed *= 0.69999998807907104D;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
if(fake && particleAge > 1)
|
||||
|
||||
@@ -13,7 +13,6 @@ import mezz.jei.api.IJeiHelpers;
|
||||
import mezz.jei.api.IJeiRuntime;
|
||||
import mezz.jei.api.IModPlugin;
|
||||
import mezz.jei.api.IModRegistry;
|
||||
import mezz.jei.api.IRecipeRegistry;
|
||||
import mezz.jei.api.JEIPlugin;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.client.integration.jei.brewery.BreweryRecipeCategory;
|
||||
@@ -34,17 +33,10 @@ public class JEIBotaniaPlugin implements IModPlugin {
|
||||
|
||||
private IJeiHelpers jeiHelpers;
|
||||
|
||||
@Override
|
||||
public void onJeiHelpersAvailable(IJeiHelpers jeiHelpers) {
|
||||
this.jeiHelpers = jeiHelpers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRegistryAvailable(IItemRegistry itemRegistry) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(IModRegistry registry) {
|
||||
jeiHelpers = registry.getJeiHelpers();
|
||||
|
||||
registry.addRecipeCategories(
|
||||
new BreweryRecipeCategory(jeiHelpers.getGuiHelper()),
|
||||
new PureDaisyRecipeCategory(jeiHelpers.getGuiHelper()),
|
||||
@@ -72,11 +64,6 @@ public class JEIBotaniaPlugin implements IModPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecipeRegistryAvailable(IRecipeRegistry recipeRegistry) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRuntimeAvailable(IJeiRuntime jeiRuntime) {
|
||||
}
|
||||
public void onRuntimeAvailable(IJeiRuntime jeiRuntime) {}
|
||||
|
||||
}
|
||||
@@ -63,10 +63,6 @@ public class BreweryRecipeWrapper implements IRecipeWrapper {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
|
||||
}
|
||||
|
||||
-4
@@ -60,10 +60,6 @@ public class ElvenTradeRecipeWrapper implements IRecipeWrapper {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
|
||||
}
|
||||
|
||||
-4
@@ -70,10 +70,6 @@ public class ManaPoolRecipeWrapper implements IRecipeWrapper {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
|
||||
GlStateManager.enableAlpha();
|
||||
|
||||
-4
@@ -59,10 +59,6 @@ public class PetalApothecaryRecipeWrapper implements IRecipeWrapper {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
|
||||
}
|
||||
|
||||
-4
@@ -69,10 +69,6 @@ public class PureDaisyRecipeWrapper implements IRecipeWrapper {
|
||||
return fluidOutputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
|
||||
}
|
||||
|
||||
-4
@@ -65,10 +65,6 @@ public class RunicAltarRecipeWrapper implements IRecipeWrapper {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
|
||||
GlStateManager.enableAlpha();
|
||||
|
||||
@@ -15,8 +15,10 @@ import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumHandSide;
|
||||
|
||||
public class ModelArmorElementium extends ModelBiped {
|
||||
|
||||
@@ -51,9 +53,9 @@ public class ModelArmorElementium extends ModelBiped {
|
||||
public ModelRenderer wing1_3;
|
||||
public ModelRenderer wing2_3;
|
||||
|
||||
int slot;
|
||||
private final EntityEquipmentSlot slot;
|
||||
|
||||
public ModelArmorElementium(int slot) {
|
||||
public ModelArmorElementium(EntityEquipmentSlot slot) {
|
||||
this.slot = slot;
|
||||
|
||||
textureWidth = 64;
|
||||
@@ -211,21 +213,21 @@ public class ModelArmorElementium extends ModelBiped {
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
helm.showModel = slot == 3; // 1.8: now reversed. Yay mojang.
|
||||
body.showModel = slot == 2;
|
||||
armR.showModel = slot == 2;
|
||||
armL.showModel = slot == 2;
|
||||
legR.showModel = slot == 1;
|
||||
legL.showModel = slot == 1;
|
||||
bootL.showModel = slot == 0;
|
||||
bootR.showModel = slot == 0;
|
||||
helm.showModel = slot == EntityEquipmentSlot.HEAD;
|
||||
body.showModel = slot == EntityEquipmentSlot.CHEST;
|
||||
armR.showModel = slot == EntityEquipmentSlot.CHEST;
|
||||
armL.showModel = slot == EntityEquipmentSlot.CHEST;
|
||||
legR.showModel = slot == EntityEquipmentSlot.LEGS;
|
||||
legL.showModel = slot == EntityEquipmentSlot.LEGS;
|
||||
bootL.showModel = slot == EntityEquipmentSlot.FEET;
|
||||
bootR.showModel = slot == EntityEquipmentSlot.FEET;
|
||||
bipedHeadwear.showModel = false;
|
||||
|
||||
bipedHead = helm;
|
||||
bipedBody = body;
|
||||
bipedRightArm = armR;
|
||||
bipedLeftArm = armL;
|
||||
if(slot == 1) {
|
||||
if(slot == EntityEquipmentSlot.LEGS) {
|
||||
bipedRightLeg = legR;
|
||||
bipedLeftLeg = legL;
|
||||
} else {
|
||||
@@ -239,23 +241,46 @@ public class ModelArmorElementium extends ModelBiped {
|
||||
|
||||
public void prepareForRender(Entity entity) {
|
||||
EntityLivingBase living = (EntityLivingBase) entity;
|
||||
isSneak = living != null ? living.isSneaking() : false;
|
||||
isChild = living != null ? living.isChild() : false;
|
||||
if(living != null && living instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) living;
|
||||
isSneak = living != null && living.isSneaking();
|
||||
isChild = living != null && living.isChild();
|
||||
if(living != null) {
|
||||
ModelBiped.ArmPose mainPose = ArmPose.EMPTY;
|
||||
ModelBiped.ArmPose offPose = ArmPose.EMPTY;
|
||||
|
||||
ItemStack itemstack = player.inventory.getCurrentItem();
|
||||
heldItemRight = itemstack != null ? 1 : 0;
|
||||
// Copy from RenderPlayer.setModelVisibilities
|
||||
if(living.getHeldItemMainhand() != null) {
|
||||
mainPose = ArmPose.ITEM;
|
||||
if (living.getItemInUseCount() > 0) {
|
||||
EnumAction enumaction = living.getHeldItemMainhand().getItemUseAction();
|
||||
|
||||
aimedBow = false;
|
||||
if (itemstack != null && player.getItemInUseCount() > 0) {
|
||||
EnumAction enumaction = itemstack.getItemUseAction();
|
||||
|
||||
if (enumaction == EnumAction.BLOCK)
|
||||
heldItemRight = 3;
|
||||
else if (enumaction == EnumAction.BOW)
|
||||
aimedBow = true;
|
||||
if (enumaction == EnumAction.BLOCK) {
|
||||
mainPose = ModelBiped.ArmPose.BLOCK;
|
||||
} else if (enumaction == EnumAction.BOW) {
|
||||
mainPose = ModelBiped.ArmPose.BOW_AND_ARROW;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (living.getHeldItemOffhand() != null) {
|
||||
offPose = ModelBiped.ArmPose.ITEM;
|
||||
|
||||
if (living.getItemInUseCount() > 0) {
|
||||
EnumAction enumaction1 = living.getHeldItemOffhand().getItemUseAction();
|
||||
|
||||
if (enumaction1 == EnumAction.BLOCK) {
|
||||
offPose = ModelBiped.ArmPose.BLOCK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(living.getPrimaryHand() == EnumHandSide.RIGHT) {
|
||||
rightArmPose = mainPose;
|
||||
leftArmPose = offPose;
|
||||
} else {
|
||||
rightArmPose = offPose;
|
||||
leftArmPose = mainPose;
|
||||
}
|
||||
// End copy RenderPlayer.setModelVisibilities
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,8 +15,10 @@ import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumHandSide;
|
||||
|
||||
public class ModelArmorManasteel extends ModelBiped {
|
||||
|
||||
@@ -41,9 +43,9 @@ public class ModelArmorManasteel extends ModelBiped {
|
||||
public ModelRenderer legR;
|
||||
public ModelRenderer legL;
|
||||
|
||||
int slot;
|
||||
private final EntityEquipmentSlot slot;
|
||||
|
||||
public ModelArmorManasteel(int slot) {
|
||||
public ModelArmorManasteel(EntityEquipmentSlot slot) {
|
||||
this.slot = slot;
|
||||
|
||||
textureWidth = 64;
|
||||
@@ -141,21 +143,21 @@ public class ModelArmorManasteel extends ModelBiped {
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
helm.showModel = slot == 3; // 1.8: now reversed. yay mojang.
|
||||
body.showModel = slot == 2;
|
||||
armR.showModel = slot == 2;
|
||||
armL.showModel = slot == 2;
|
||||
legR.showModel = slot == 1;
|
||||
legL.showModel = slot == 1;
|
||||
bootL.showModel = slot == 0;
|
||||
bootR.showModel = slot == 0;
|
||||
helm.showModel = slot == EntityEquipmentSlot.HEAD;
|
||||
body.showModel = slot == EntityEquipmentSlot.CHEST;
|
||||
armR.showModel = slot == EntityEquipmentSlot.CHEST;
|
||||
armL.showModel = slot == EntityEquipmentSlot.CHEST;
|
||||
legR.showModel = slot == EntityEquipmentSlot.LEGS;
|
||||
legL.showModel = slot == EntityEquipmentSlot.LEGS;
|
||||
bootL.showModel = slot == EntityEquipmentSlot.FEET;
|
||||
bootR.showModel = slot == EntityEquipmentSlot.FEET;
|
||||
bipedHeadwear.showModel = false;
|
||||
|
||||
bipedHead = helm;
|
||||
bipedBody = body;
|
||||
bipedRightArm = armR;
|
||||
bipedLeftArm = armL;
|
||||
if(slot == 1) {
|
||||
if(slot == EntityEquipmentSlot.LEGS) {
|
||||
bipedRightLeg = legR;
|
||||
bipedLeftLeg = legL;
|
||||
} else {
|
||||
@@ -169,23 +171,46 @@ public class ModelArmorManasteel extends ModelBiped {
|
||||
|
||||
public void prepareForRender(Entity entity) {
|
||||
EntityLivingBase living = (EntityLivingBase) entity;
|
||||
isSneak = living != null ? living.isSneaking() : false;
|
||||
isChild = living != null ? living.isChild() : false;
|
||||
if(living != null && living instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) living;
|
||||
isSneak = living != null && living.isSneaking();
|
||||
isChild = living != null && living.isChild();
|
||||
if(living != null) {
|
||||
ModelBiped.ArmPose mainPose = ArmPose.EMPTY;
|
||||
ModelBiped.ArmPose offPose = ArmPose.EMPTY;
|
||||
|
||||
ItemStack itemstack = player.inventory.getCurrentItem();
|
||||
heldItemRight = itemstack != null ? 1 : 0;
|
||||
// Copy from RenderPlayer.setModelVisibilities
|
||||
if(living.getHeldItemMainhand() != null) {
|
||||
mainPose = ArmPose.ITEM;
|
||||
if (living.getItemInUseCount() > 0) {
|
||||
EnumAction enumaction = living.getHeldItemMainhand().getItemUseAction();
|
||||
|
||||
aimedBow = false;
|
||||
if (itemstack != null && player.getItemInUseCount() > 0) {
|
||||
EnumAction enumaction = itemstack.getItemUseAction();
|
||||
|
||||
if (enumaction == EnumAction.BLOCK)
|
||||
heldItemRight = 3;
|
||||
else if(enumaction == EnumAction.BOW)
|
||||
aimedBow = true;
|
||||
if (enumaction == EnumAction.BLOCK) {
|
||||
mainPose = ModelBiped.ArmPose.BLOCK;
|
||||
} else if (enumaction == EnumAction.BOW) {
|
||||
mainPose = ModelBiped.ArmPose.BOW_AND_ARROW;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (living.getHeldItemOffhand() != null) {
|
||||
offPose = ModelBiped.ArmPose.ITEM;
|
||||
|
||||
if (living.getItemInUseCount() > 0) {
|
||||
EnumAction enumaction1 = living.getHeldItemOffhand().getItemUseAction();
|
||||
|
||||
if (enumaction1 == EnumAction.BLOCK) {
|
||||
offPose = ModelBiped.ArmPose.BLOCK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(living.getPrimaryHand() == EnumHandSide.RIGHT) {
|
||||
rightArmPose = mainPose;
|
||||
leftArmPose = offPose;
|
||||
} else {
|
||||
rightArmPose = offPose;
|
||||
leftArmPose = mainPose;
|
||||
}
|
||||
// End copy RenderPlayer.setModelVisibilities
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,8 +15,10 @@ import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumHandSide;
|
||||
|
||||
public class ModelArmorManaweave extends ModelBiped {
|
||||
|
||||
@@ -41,9 +43,9 @@ public class ModelArmorManaweave extends ModelBiped {
|
||||
public ModelRenderer skirtR;
|
||||
public ModelRenderer skirtL;
|
||||
|
||||
int slot;
|
||||
private final EntityEquipmentSlot slot;
|
||||
|
||||
public ModelArmorManaweave(int slot) {
|
||||
public ModelArmorManaweave(EntityEquipmentSlot slot) {
|
||||
this.slot = slot;
|
||||
|
||||
textureWidth = 64;
|
||||
@@ -141,21 +143,21 @@ public class ModelArmorManaweave extends ModelBiped {
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
helm.showModel = slot == 3; // 1.8: now reversed. yay mojang.
|
||||
body.showModel = slot == 2;
|
||||
armR.showModel = slot == 2;
|
||||
armL.showModel = slot == 2;
|
||||
legR.showModel = slot == 1;
|
||||
legL.showModel = slot == 1;
|
||||
bootL.showModel = slot == 0;
|
||||
bootR.showModel = slot == 0;
|
||||
helm.showModel = slot == EntityEquipmentSlot.HEAD;
|
||||
body.showModel = slot == EntityEquipmentSlot.CHEST;
|
||||
armR.showModel = slot == EntityEquipmentSlot.CHEST;
|
||||
armL.showModel = slot == EntityEquipmentSlot.CHEST;
|
||||
legR.showModel = slot == EntityEquipmentSlot.LEGS;
|
||||
legL.showModel = slot == EntityEquipmentSlot.LEGS;
|
||||
bootL.showModel = slot == EntityEquipmentSlot.FEET;
|
||||
bootR.showModel = slot == EntityEquipmentSlot.FEET;
|
||||
bipedHeadwear.showModel = false;
|
||||
|
||||
bipedHead = helm;
|
||||
bipedBody = body;
|
||||
bipedRightArm = armR;
|
||||
bipedLeftArm = armL;
|
||||
if(slot == 1) {
|
||||
if(slot == EntityEquipmentSlot.LEGS) {
|
||||
bipedRightLeg = legR;
|
||||
bipedLeftLeg = legL;
|
||||
} else {
|
||||
@@ -169,23 +171,46 @@ public class ModelArmorManaweave extends ModelBiped {
|
||||
|
||||
public void prepareForRender(Entity entity) {
|
||||
EntityLivingBase living = (EntityLivingBase) entity;
|
||||
isSneak = living != null ? living.isSneaking() : false;
|
||||
isChild = living != null ? living.isChild() : false;
|
||||
if(living != null && living instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) living;
|
||||
isSneak = living != null && living.isSneaking();
|
||||
isChild = living != null && living.isChild();
|
||||
if(living != null) {
|
||||
ModelBiped.ArmPose mainPose = ArmPose.EMPTY;
|
||||
ModelBiped.ArmPose offPose = ArmPose.EMPTY;
|
||||
|
||||
ItemStack itemstack = player.inventory.getCurrentItem();
|
||||
heldItemRight = itemstack != null ? 1 : 0;
|
||||
// Copy from RenderPlayer.setModelVisibilities
|
||||
if(living.getHeldItemMainhand() != null) {
|
||||
mainPose = ArmPose.ITEM;
|
||||
if (living.getItemInUseCount() > 0) {
|
||||
EnumAction enumaction = living.getHeldItemMainhand().getItemUseAction();
|
||||
|
||||
aimedBow = false;
|
||||
if (itemstack != null && player.getItemInUseCount() > 0) {
|
||||
EnumAction enumaction = itemstack.getItemUseAction();
|
||||
|
||||
if (enumaction == EnumAction.BLOCK)
|
||||
heldItemRight = 3;
|
||||
else if (enumaction == EnumAction.BOW)
|
||||
aimedBow = true;
|
||||
if (enumaction == EnumAction.BLOCK) {
|
||||
mainPose = ModelBiped.ArmPose.BLOCK;
|
||||
} else if (enumaction == EnumAction.BOW) {
|
||||
mainPose = ModelBiped.ArmPose.BOW_AND_ARROW;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (living.getHeldItemOffhand() != null) {
|
||||
offPose = ModelBiped.ArmPose.ITEM;
|
||||
|
||||
if (living.getItemInUseCount() > 0) {
|
||||
EnumAction enumaction1 = living.getHeldItemOffhand().getItemUseAction();
|
||||
|
||||
if (enumaction1 == EnumAction.BLOCK) {
|
||||
offPose = ModelBiped.ArmPose.BLOCK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(living.getPrimaryHand() == EnumHandSide.RIGHT) {
|
||||
rightArmPose = mainPose;
|
||||
leftArmPose = offPose;
|
||||
} else {
|
||||
rightArmPose = offPose;
|
||||
leftArmPose = mainPose;
|
||||
}
|
||||
// End copy RenderPlayer.setModelVisibilities
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,8 +15,10 @@ import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumHandSide;
|
||||
|
||||
public class ModelArmorTerrasteel extends ModelBiped {
|
||||
|
||||
@@ -54,9 +56,9 @@ public class ModelArmorTerrasteel extends ModelBiped {
|
||||
public ModelRenderer bootL2;
|
||||
public ModelRenderer bootLbranch;
|
||||
|
||||
int slot;
|
||||
private final EntityEquipmentSlot slot;
|
||||
|
||||
public ModelArmorTerrasteel(int slot) {
|
||||
public ModelArmorTerrasteel(EntityEquipmentSlot slot) {
|
||||
this.slot = slot;
|
||||
|
||||
textureWidth = 64;
|
||||
@@ -232,21 +234,21 @@ public class ModelArmorTerrasteel extends ModelBiped {
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
helm.showModel = slot == 3; // 1.8: now reversed. yay mojang.
|
||||
body.showModel = slot == 2;
|
||||
armr.showModel = slot == 2;
|
||||
armL.showModel = slot == 2;
|
||||
legR.showModel = slot == 1;
|
||||
legL.showModel = slot == 1;
|
||||
bootL.showModel = slot == 0;
|
||||
bootR.showModel = slot == 0;
|
||||
helm.showModel = slot == EntityEquipmentSlot.HEAD;
|
||||
body.showModel = slot == EntityEquipmentSlot.CHEST;
|
||||
armr.showModel = slot == EntityEquipmentSlot.CHEST;
|
||||
armL.showModel = slot == EntityEquipmentSlot.CHEST;
|
||||
legR.showModel = slot == EntityEquipmentSlot.LEGS;
|
||||
legL.showModel = slot == EntityEquipmentSlot.LEGS;
|
||||
bootL.showModel = slot == EntityEquipmentSlot.FEET;
|
||||
bootR.showModel = slot == EntityEquipmentSlot.FEET;
|
||||
bipedHeadwear.showModel = false;
|
||||
|
||||
bipedHead = helm;
|
||||
bipedBody = body;
|
||||
bipedRightArm = armr;
|
||||
bipedLeftArm = armL;
|
||||
if(slot == 1) {
|
||||
if(slot == EntityEquipmentSlot.LEGS) {
|
||||
bipedRightLeg = legR;
|
||||
bipedLeftLeg = legL;
|
||||
} else {
|
||||
@@ -260,23 +262,46 @@ public class ModelArmorTerrasteel extends ModelBiped {
|
||||
|
||||
public void prepareForRender(Entity entity) {
|
||||
EntityLivingBase living = (EntityLivingBase) entity;
|
||||
isSneak = living != null ? living.isSneaking() : false;
|
||||
isChild = living != null ? living.isChild() : false;
|
||||
if(living != null && living instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) living;
|
||||
isSneak = living != null && living.isSneaking();
|
||||
isChild = living != null && living.isChild();
|
||||
if(living != null) {
|
||||
ModelBiped.ArmPose mainPose = ArmPose.EMPTY;
|
||||
ModelBiped.ArmPose offPose = ArmPose.EMPTY;
|
||||
|
||||
ItemStack itemstack = player.inventory.getCurrentItem();
|
||||
heldItemRight = itemstack != null ? 1 : 0;
|
||||
// Copy from RenderPlayer.setModelVisibilities
|
||||
if(living.getHeldItemMainhand() != null) {
|
||||
mainPose = ArmPose.ITEM;
|
||||
if (living.getItemInUseCount() > 0) {
|
||||
EnumAction enumaction = living.getHeldItemMainhand().getItemUseAction();
|
||||
|
||||
aimedBow = false;
|
||||
if (itemstack != null && player.getItemInUseCount() > 0) {
|
||||
EnumAction enumaction = itemstack.getItemUseAction();
|
||||
|
||||
if (enumaction == EnumAction.BLOCK)
|
||||
heldItemRight = 3;
|
||||
else if (enumaction == EnumAction.BOW)
|
||||
aimedBow = true;
|
||||
if (enumaction == EnumAction.BLOCK) {
|
||||
mainPose = ModelBiped.ArmPose.BLOCK;
|
||||
} else if (enumaction == EnumAction.BOW) {
|
||||
mainPose = ModelBiped.ArmPose.BOW_AND_ARROW;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (living.getHeldItemOffhand() != null) {
|
||||
offPose = ModelBiped.ArmPose.ITEM;
|
||||
|
||||
if (living.getItemInUseCount() > 0) {
|
||||
EnumAction enumaction1 = living.getHeldItemOffhand().getItemUseAction();
|
||||
|
||||
if (enumaction1 == EnumAction.BLOCK) {
|
||||
offPose = ModelBiped.ArmPose.BLOCK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(living.getPrimaryHand() == EnumHandSide.RIGHT) {
|
||||
rightArmPose = mainPose;
|
||||
leftArmPose = offPose;
|
||||
} else {
|
||||
rightArmPose = offPose;
|
||||
leftArmPose = mainPose;
|
||||
}
|
||||
// End copy RenderPlayer.setModelVisibilities
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
|
||||
|
||||
import net.minecraft.network.datasync.DataParameter;
|
||||
import vazkii.botania.client.core.handler.MiscellaneousIcons;
|
||||
import vazkii.botania.common.entity.EntityCorporeaSpark;
|
||||
|
||||
@@ -25,6 +26,10 @@ public class RenderCorporeaSpark extends RenderSparkBase<EntityCorporeaSpark> {
|
||||
super(p_i46185_1_);
|
||||
}
|
||||
|
||||
protected DataParameter<Integer> getInvisibilityParam() {
|
||||
return EntityCorporeaSpark.INVISIBILITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureAtlasSprite getBaseIcon(EntityCorporeaSpark entity) {
|
||||
return entity.isMaster() ? MiscellaneousIcons.INSTANCE.corporeaWorldIconMaster : MiscellaneousIcons.INSTANCE.corporeaWorldIcon;
|
||||
|
||||
@@ -27,10 +27,10 @@ public class RenderPinkWither extends RenderWither {
|
||||
@Override
|
||||
public void doRender(EntityWither p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) {
|
||||
super.doRender(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
|
||||
if(BossStatus.bossName.equals(p_76986_1_.getDisplayName().getFormattedText())) {
|
||||
/*if(BossStatus.bossName.equals(p_76986_1_.getDisplayName().getFormattedText())) { todo 1.9
|
||||
BossStatus.statusBarTime = -1;
|
||||
BossStatus.hasColorModifier = false;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,6 +12,7 @@ package vazkii.botania.client.render.entity;
|
||||
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.network.datasync.DataParameter;
|
||||
import vazkii.botania.client.core.handler.MiscellaneousIcons;
|
||||
import vazkii.botania.common.entity.EntitySpark;
|
||||
|
||||
@@ -21,6 +22,10 @@ public class RenderSpark extends RenderSparkBase<EntitySpark> {
|
||||
super(renderManager);
|
||||
}
|
||||
|
||||
protected DataParameter<Integer> getInvisibilityParam() {
|
||||
return EntitySpark.INVISIBILITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureAtlasSprite getSpinningIcon(EntitySpark entity) {
|
||||
int upgrade = entity.getUpgrade().ordinal() - 1;
|
||||
|
||||
@@ -14,29 +14,31 @@ import java.util.Random;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderEntity;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.network.datasync.DataParameter;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
import vazkii.botania.client.core.handler.MiscellaneousIcons;
|
||||
import vazkii.botania.common.entity.EntityCorporeaSpark;
|
||||
import vazkii.botania.common.entity.EntitySpark;
|
||||
|
||||
public class RenderSparkBase<T extends Entity> extends RenderEntity {
|
||||
public abstract class RenderSparkBase<T extends Entity> extends Render<T> {
|
||||
|
||||
public RenderSparkBase(RenderManager p_i46185_1_) {
|
||||
super(p_i46185_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) {
|
||||
T tEntity = (T) par1Entity;
|
||||
public void doRender(T tEntity, double par2, double par4, double par6, float par8, float par9) {
|
||||
TextureAtlasSprite iicon = getBaseIcon(tEntity);
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
@@ -47,15 +49,15 @@ public class RenderSparkBase<T extends Entity> extends RenderEntity {
|
||||
GlStateManager.alphaFunc(GL11.GL_GREATER, 0.05F);
|
||||
|
||||
double time = ClientTickHandler.ticksInGame + par9;
|
||||
time += new Random(par1Entity.getEntityId()).nextInt();
|
||||
time += new Random(tEntity.getEntityId()).nextInt();
|
||||
|
||||
float a = 0.1F + (1 - par1Entity.getDataManager().get(EntitySpark.INVSIBILITY)) * 0.8F;
|
||||
float a = 0.1F + (1 - tEntity.getDataManager().get(getInvisibilityParam())) * 0.8F;
|
||||
|
||||
GlStateManager.color(1F, 1F, 1F, (0.7F + 0.3F * (float) (Math.sin(time / 5.0) + 0.5) * 2) * a);
|
||||
|
||||
float scale = 0.75F + 0.1F * (float) Math.sin(time / 10);
|
||||
GlStateManager.scale(scale, scale, scale);
|
||||
bindEntityTexture(par1Entity);
|
||||
bindEntityTexture(tEntity);
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
@@ -80,6 +82,8 @@ public class RenderSparkBase<T extends Entity> extends RenderEntity {
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
protected abstract DataParameter<Integer> getInvisibilityParam();
|
||||
|
||||
protected TextureAtlasSprite getBaseIcon(T entity) {
|
||||
return MiscellaneousIcons.INSTANCE.sparkWorldIcon;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BlockRendererDispatcher;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -52,9 +51,7 @@ public class RenderTileFloatingFlower extends TileEntitySpecialRenderer {
|
||||
|
||||
IBlockState state = tile.getWorld().getBlockState(tile.getPos());
|
||||
state = state.getBlock().getExtendedState(state, tile.getWorld(), tile.getPos());
|
||||
IBakedModel ibakedmodel = FloatingFlowerModel.INSTANCE.handleBlockState(state);
|
||||
|
||||
brd.getBlockModelRenderer().renderModelBrightness(ibakedmodel, state, 1.0F, true);
|
||||
brd.getBlockModelRenderer().renderModelBrightness(FloatingFlowerModel.INSTANCE, state, 1.0F, true);
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
|
||||
@@ -40,7 +40,10 @@ import vazkii.botania.common.lib.LibBlockNames;
|
||||
|
||||
public class BlockAvatar extends BlockMod implements ILexiconable {
|
||||
|
||||
Random random;
|
||||
private static final AxisAlignedBB X_AABB = new AxisAlignedBB(.3125, 0, .21875, 1-.3125, 17/16.0, 1-.21875);
|
||||
private static final AxisAlignedBB Z_AABB = new AxisAlignedBB(.21875, 0, .3125, 1-.21875, 17/16.0, 1-.3125);
|
||||
|
||||
private final Random random = new Random();
|
||||
|
||||
protected BlockAvatar() {
|
||||
super(Material.wood);
|
||||
@@ -48,20 +51,13 @@ public class BlockAvatar extends BlockMod implements ILexiconable {
|
||||
setSoundType(SoundType.WOOD);
|
||||
setUnlocalizedName(LibBlockNames.AVATAR);
|
||||
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.NORTH));
|
||||
random = new Random();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
float f = 1F / 16F;
|
||||
float w = f * 9;
|
||||
float l = f * 6;
|
||||
float ws = (1F - w) / 2;
|
||||
float ls = (1F - l) / 2;
|
||||
|
||||
if(state.getValue(BotaniaStateProps.CARDINALS).getAxis() == EnumFacing.Axis.Z)
|
||||
setBlockBounds(ws, 0F, ls, 1F - ws, 1F + f, 1F - ls);
|
||||
else setBlockBounds(ls, 0F, ws, 1F - ls, 1F + f, 1F - ws);
|
||||
if(state.getValue(BotaniaStateProps.CARDINALS).getAxis() == EnumFacing.Axis.X)
|
||||
return X_AABB;
|
||||
else return Z_AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,6 +20,7 @@ import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
@@ -34,12 +35,14 @@ import vazkii.botania.common.lib.LibBlockNames;
|
||||
|
||||
public class BlockIncensePlate extends BlockMod implements ILexiconable {
|
||||
|
||||
private static final AxisAlignedBB X_AABB = new AxisAlignedBB(0.375, 0, 0.125, 0.625, 1/16.0, 0.875);
|
||||
private static final AxisAlignedBB Z_AABB = new AxisAlignedBB(0.125, 0, 0.375, 0.875, 1/16.0, 0.625);
|
||||
|
||||
protected BlockIncensePlate() {
|
||||
super(Material.wood);
|
||||
setUnlocalizedName(LibBlockNames.INCENSE_PLATE);
|
||||
setHardness(2.0F);
|
||||
setSoundType(SoundType.WOOD);
|
||||
setBlockBounds(EnumFacing.Axis.Z);
|
||||
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH));
|
||||
}
|
||||
|
||||
@@ -110,15 +113,13 @@ public class BlockIncensePlate extends BlockMod implements ILexiconable {
|
||||
return ((TileIncensePlate) world.getTileEntity(pos)).comparatorOutput;
|
||||
}
|
||||
|
||||
public void setBlockBounds(EnumFacing.Axis axis) {
|
||||
float f = 1F / 16F;
|
||||
float w = 12 * f;
|
||||
float l = 4 * f;
|
||||
float xs = (1F - w) / 2;
|
||||
float zs = (1F - l) / 2;
|
||||
if(axis == EnumFacing.Axis.Z)
|
||||
setBlockBounds(xs, 0F, zs, 1F - xs, f, 1f - zs);
|
||||
else setBlockBounds(zs, 0F, xs, 1F - zs, f, 1f - xs);
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
if(state.getValue(BotaniaStateProps.CARDINALS).getAxis() == EnumFacing.Axis.X) {
|
||||
return X_AABB;
|
||||
} else {
|
||||
return Z_AABB;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -98,7 +98,7 @@ public class BlockLightLauncher extends BlockMod implements ILexiconable {
|
||||
|
||||
public void pickUpEntities(World world, BlockPos pos) {
|
||||
List<TileLightRelay> relays = new ArrayList<>();
|
||||
for(EnumFacing dir : LibMisc.CARDINAL_DIRECTIONS) {
|
||||
for(EnumFacing dir : EnumFacing.HORIZONTALS) {
|
||||
TileEntity tile = world.getTileEntity(pos.offset(dir));
|
||||
if(tile instanceof TileLightRelay) {
|
||||
TileLightRelay relay = (TileLightRelay) tile;
|
||||
|
||||
@@ -21,6 +21,7 @@ import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Enchantments;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -107,11 +108,12 @@ public abstract class BlockModDoubleFlower extends BlockDoublePlant implements I
|
||||
}
|
||||
|
||||
// This is how I get around encapsulation
|
||||
// todo 1.9 is this necessary?
|
||||
public void harvestBlockCopy(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state) {
|
||||
player.triggerAchievement(StatList.mineBlockStatArray[getIdFromBlock(this)]);
|
||||
player.addStat(StatList.getBlockStats(this));
|
||||
player.addExhaustion(0.025F);
|
||||
|
||||
if (this.canSilkHarvest(worldIn, pos, worldIn.getBlockState(pos), player) && EnchantmentHelper.getSilkTouchModifier(player))
|
||||
if (this.canSilkHarvest(worldIn, pos, worldIn.getBlockState(pos), player) && EnchantmentHelper.getEnchantmentLevel(Enchantments.silkTouch, player.getHeldItemMainhand()) > 0)
|
||||
{
|
||||
java.util.ArrayList<ItemStack> items = new java.util.ArrayList<>();
|
||||
ItemStack itemstack = this.createStackedBlock(state);
|
||||
@@ -130,7 +132,7 @@ public abstract class BlockModDoubleFlower extends BlockDoublePlant implements I
|
||||
else
|
||||
{
|
||||
harvesters.set(player);
|
||||
int i = EnchantmentHelper.getFortuneModifier(player);
|
||||
int i = EnchantmentHelper.getEnchantmentLevel(Enchantments.fortune, player.getHeldItemMainhand());
|
||||
this.dropBlockAsItem(worldIn, pos, state, i);
|
||||
harvesters.set(null);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,11 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
public class BlockSolidVines extends BlockVine implements ILexiconable {
|
||||
|
||||
protected static final AxisAlignedBB LADDER_EAST_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.1875D, 1.0D, 1.0D);
|
||||
protected static final AxisAlignedBB LADDER_WEST_AABB = new AxisAlignedBB(0.8125D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
|
||||
protected static final AxisAlignedBB LADDER_SOUTH_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.1875D);
|
||||
protected static final AxisAlignedBB LADDER_NORTH_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.8125D, 1.0D, 1.0D, 1.0D);
|
||||
|
||||
public BlockSolidVines() {
|
||||
setUnlocalizedName(LibBlockNames.SOLID_VINE);
|
||||
setHardness(0.5F);
|
||||
@@ -40,18 +45,18 @@ public class BlockSolidVines extends BlockVine implements ILexiconable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox(World w, BlockPos pos, IBlockState state) {
|
||||
setBlockBoundsBasedOnState(w, pos);
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, World world, BlockPos pos) {
|
||||
AxisAlignedBB bounds = getBoundingBox(state, world, pos);
|
||||
|
||||
if(state.getValue(EAST)) {
|
||||
return new AxisAlignedBB(pos.add(maxX, minY, minZ), pos.add(maxX, maxY, maxZ));
|
||||
return new AxisAlignedBB(pos.add(bounds.maxX, bounds.minY, bounds.minZ), pos.add(bounds.maxX, bounds.maxY, bounds.maxZ));
|
||||
}
|
||||
|
||||
if(state.getValue(SOUTH)) {
|
||||
return new AxisAlignedBB(pos.add(minX, minY, maxZ), pos.add(maxX, maxY, maxZ));
|
||||
return new AxisAlignedBB(pos.add(bounds.minX, bounds.minY, bounds.maxZ), pos.add(bounds.maxX, bounds.maxY, bounds.maxZ));
|
||||
}
|
||||
|
||||
return new AxisAlignedBB(pos.add(minX, minY, minZ), pos.add(maxX, maxY, maxZ));
|
||||
return new AxisAlignedBB(pos.add(bounds.minX, bounds.minY, bounds.minZ), pos.add(bounds.maxX, bounds.maxY, bounds.maxZ));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -24,11 +25,14 @@ import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.passive.EntityCow;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.IShearable;
|
||||
import vazkii.botania.api.internal.IManaBurst;
|
||||
@@ -46,17 +50,21 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
public class BlockForestDrum extends BlockMod implements IManaTrigger, ILexiconable {
|
||||
|
||||
private static final AxisAlignedBB AABB = new AxisAlignedBB(3/16.0, 0, 3/16.0, 13/16.0, 14/16.0, 13/16.0);
|
||||
|
||||
public BlockForestDrum() {
|
||||
super(Material.wood);
|
||||
float f = 1F / 16F;
|
||||
setBlockBounds(f * 3, 0F, f * 3, 1F - f * 3, 1F - f * 2, 1F - f * 3);
|
||||
|
||||
setHardness(2.0F);
|
||||
setSoundType(SoundType.WOOD);
|
||||
setUnlocalizedName(LibBlockNames.FOREST_DRUM);
|
||||
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.DRUM_VARIANT, DrumVariant.WILD));
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, BotaniaStateProps.DRUM_VARIANT);
|
||||
@@ -164,7 +172,7 @@ public class BlockForestDrum extends BlockMod implements IManaTrigger, ILexicona
|
||||
|
||||
if(!world.isRemote)
|
||||
for(int i = 0; i < 10; i++)
|
||||
world.playSoundEffect(pos.getX(), pos.getY(), pos.getZ(), "note.bd", 1F, 1F);
|
||||
world.playSound(null, pos, SoundEvents.block_note_basedrum, SoundCategory.BLOCKS, 1F, 1F);
|
||||
else world.spawnParticle(EnumParticleTypes.NOTE, pos.getX() + 0.5, pos.getY() + 1.2, pos.getZ() + 0.5D, 1.0 / 24.0, 0, 0);
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ package vazkii.botania.common.block.mana;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -40,7 +41,7 @@ public class BlockManaDetector extends BlockMod implements ILexiconable {
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(10.0F);
|
||||
setSoundType(Block.SoundType.STONE);
|
||||
setSoundType(SoundType.STONE);
|
||||
setUnlocalizedName(LibBlockNames.MANA_DETECTOR);
|
||||
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false));
|
||||
}
|
||||
@@ -61,19 +62,19 @@ public class BlockManaDetector extends BlockMod implements ILexiconable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvidePower() {
|
||||
public boolean canProvidePower(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWeakPower(IBlockAccess par1iBlockAccess, BlockPos pos, IBlockState state, EnumFacing side) {
|
||||
public int getWeakPower(IBlockState state, IBlockAccess par1iBlockAccess, BlockPos pos, EnumFacing side) {
|
||||
return state.getValue(BotaniaStateProps.POWERED) ? 15 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World par1World, BlockPos pos, IBlockState state, AxisAlignedBB par5AxisAlignedBB, List<AxisAlignedBB> par6List, Entity par7Entity) {
|
||||
public void addCollisionBoxToList(IBlockState state, World par1World, BlockPos pos, AxisAlignedBB par5AxisAlignedBB, List<AxisAlignedBB> par6List, Entity par7Entity) {
|
||||
if(par7Entity != null && !(par7Entity instanceof IManaBurst))
|
||||
super.addCollisionBoxesToList(par1World, pos, state, par5AxisAlignedBB, par6List, par7Entity);
|
||||
super.addCollisionBoxToList(state, par1World, pos, par5AxisAlignedBB, par6List, par7Entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*/
|
||||
package vazkii.botania.common.block.mana;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
@@ -36,7 +36,7 @@ public class BlockManaVoid extends BlockMod implements ILexiconable, IPoolOverla
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(2000F);
|
||||
setSoundType(Block.SoundType.STONE);
|
||||
setSoundType(SoundType.STONE);
|
||||
setUnlocalizedName(LibBlockNames.MANA_VOID);
|
||||
}
|
||||
|
||||
|
||||
@@ -153,20 +153,20 @@ public class BlockPool extends BlockMod implements IWandHUD, IWandable, ILexicon
|
||||
}
|
||||
}
|
||||
|
||||
private static final AxisAlignedBB BOTTOM_AABB = new AxisAlignedBB(0, 0, 0, 1, 1/16.0, 1);
|
||||
private static final AxisAlignedBB NORTH_AABB = new AxisAlignedBB(0, 0, 15/16.0, 1, 0.5, 1);
|
||||
private static final AxisAlignedBB SOUTH_AABB = new AxisAlignedBB(0, 0, 0, 1, 0.7, 1/16.0);
|
||||
private static final AxisAlignedBB WEST_AABB = new AxisAlignedBB(0, 0, 0, 1/16.0, 0.5, 1);
|
||||
private static final AxisAlignedBB EAST_AABB = new AxisAlignedBB(15/16.0, 0, 0, 1, 0.5, 1);
|
||||
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World p_149743_1_, BlockPos pos, IBlockState state, AxisAlignedBB p_149743_5_, List<AxisAlignedBB> p_149743_6_, Entity p_149743_7_) {
|
||||
float f = 1F / 16F;
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F);
|
||||
super.addCollisionBoxesToList(p_149743_1_, pos, state, p_149743_5_, p_149743_6_, p_149743_7_);
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, f, 0.5F, 1.0F);
|
||||
super.addCollisionBoxesToList(p_149743_1_, pos, state, p_149743_5_, p_149743_6_, p_149743_7_);
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, f);
|
||||
super.addCollisionBoxesToList(p_149743_1_, pos, state, p_149743_5_, p_149743_6_, p_149743_7_);
|
||||
setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
|
||||
super.addCollisionBoxesToList(p_149743_1_, pos, state, p_149743_5_, p_149743_6_, p_149743_7_);
|
||||
setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 0.5F, 1.0F);
|
||||
super.addCollisionBoxesToList(p_149743_1_, pos, state, p_149743_5_, p_149743_6_, p_149743_7_);
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
|
||||
public void addCollisionBoxToList(IBlockState state, World p_149743_1_, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> boxes, Entity entity) {
|
||||
addCollisionBoxToList(pos, entityBox, boxes, BOTTOM_AABB);
|
||||
addCollisionBoxToList(pos, entityBox, boxes, NORTH_AABB);
|
||||
addCollisionBoxToList(pos, entityBox, boxes, SOUTH_AABB);
|
||||
addCollisionBoxToList(pos, entityBox, boxes, WEST_AABB);
|
||||
addCollisionBoxToList(pos, entityBox, boxes, EAST_AABB);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
package vazkii.botania.common.block.mana;
|
||||
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
@@ -18,6 +19,7 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
@@ -35,13 +37,15 @@ import vazkii.botania.common.lib.LibBlockNames;
|
||||
|
||||
public class BlockPump extends BlockMod implements ILexiconable {
|
||||
|
||||
private static final AxisAlignedBB X_AABB = new AxisAlignedBB(0, 0, 0.25, 1, 0.5, 0.75);
|
||||
private static final AxisAlignedBB Z_AABB = new AxisAlignedBB(0.25, 0, 0, 0.75, 0.5, 1);
|
||||
|
||||
public BlockPump() {
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(10.0F);
|
||||
setSoundType(SoundType.STONE);
|
||||
setUnlocalizedName(LibBlockNames.PUMP);
|
||||
setBlockBounds(EnumFacing.Axis.X);
|
||||
setDefaultState(blockState.getBaseState().withProperty(Properties.StaticProperty, true).withProperty(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH));
|
||||
}
|
||||
|
||||
@@ -74,16 +78,11 @@ public class BlockPump extends BlockMod implements ILexiconable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess w, BlockPos pos) {
|
||||
EnumFacing facing = w.getBlockState(pos).getValue(BotaniaStateProps.CARDINALS);
|
||||
setBlockBounds(facing.getAxis());
|
||||
}
|
||||
|
||||
public void setBlockBounds(EnumFacing.Axis axis) {
|
||||
if (axis == EnumFacing.Axis.X) {
|
||||
setBlockBounds(0F, 0F, 0.25F, 1F, 0.5F, 0.75F);
|
||||
} else if (axis == EnumFacing.Axis.Z) {
|
||||
setBlockBounds(0.25F, 0F, 0F, 0.75F, 0.5F, 1F);
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
if(state.getValue(BotaniaStateProps.CARDINALS).getAxis() == EnumFacing.Axis.X) {
|
||||
return X_AABB;
|
||||
} else {
|
||||
return Z_AABB;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,12 +97,12 @@ public class BlockPump extends BlockMod implements ILexiconable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride() {
|
||||
public boolean hasComparatorInputOverride(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, BlockPos pos) {
|
||||
public int getComparatorInputOverride(IBlockState state, World world, BlockPos pos) {
|
||||
return ((TilePump) world.getTileEntity(pos)).comparator;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,9 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
@@ -31,14 +33,17 @@ import vazkii.botania.common.lib.LibBlockNames;
|
||||
|
||||
public class BlockSpawnerClaw extends BlockMod implements ILexiconable {
|
||||
|
||||
private static final AxisAlignedBB AABB = new AxisAlignedBB(0.125, 0, 0.125, 0.875, 1/16.0, 0.875);
|
||||
|
||||
public BlockSpawnerClaw() {
|
||||
super(Material.iron);
|
||||
setHardness(3.0F);
|
||||
setUnlocalizedName(LibBlockNames.SPAWNER_CLAW);
|
||||
}
|
||||
|
||||
float f = 1F / 8F;
|
||||
float f1 = 1F / 16F;
|
||||
setBlockBounds(f, 0F, f, 1F - f, f1, 1F - f);
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
package vazkii.botania.common.block.mana;
|
||||
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
@@ -28,7 +28,7 @@ public class SubTileManastar extends SubTileEntity {
|
||||
super.onUpdate();
|
||||
|
||||
int mana = 0;
|
||||
for(EnumFacing dir : LibMisc.CARDINAL_DIRECTIONS) {
|
||||
for(EnumFacing dir : EnumFacing.HORIZONTALS) {
|
||||
TileEntity tile = supertile.getWorld().getTileEntity(supertile.getPos().offset(dir));
|
||||
if(tile instanceof IManaPool)
|
||||
mana += ((IManaPool) tile).getCurrentMana();
|
||||
|
||||
@@ -185,14 +185,14 @@ public class SubTileHopperhock extends SubTileFunctional {
|
||||
Block chest = supertile.getWorld().getBlockState(pos).getBlock();
|
||||
|
||||
if(tileEntity instanceof TileEntityChest)
|
||||
for(EnumFacing dir : LibMisc.CARDINAL_DIRECTIONS)
|
||||
for(EnumFacing dir : EnumFacing.HORIZONTALS)
|
||||
if(supertile.getWorld().getBlockState(pos.offset(dir)).getBlock() == chest) {
|
||||
filter.addAll(getFilterForInventory(pos.offset(dir), false));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for(EnumFacing dir : LibMisc.CARDINAL_DIRECTIONS) {
|
||||
for(EnumFacing dir : EnumFacing.HORIZONTALS) {
|
||||
AxisAlignedBB aabb = new AxisAlignedBB(pos.offset(dir), pos.offset(dir).add(1, 1, 1));
|
||||
List<EntityItemFrame> frames = supertile.getWorld().getEntitiesWithinAABB(EntityItemFrame.class, aabb);
|
||||
for(EntityItemFrame frame : frames) {
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ public class SubTileHydroangeas extends SubTilePassiveGenerating {
|
||||
supertile.getWorld().setBlockToAir(pos);
|
||||
else {
|
||||
int waterAround = 0;
|
||||
for(EnumFacing dir : LibMisc.CARDINAL_DIRECTIONS)
|
||||
for(EnumFacing dir : EnumFacing.HORIZONTALS)
|
||||
if(supertile.getWorld().getBlockState(pos.offset(dir)).getMaterial() == search)
|
||||
waterAround++;
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ public class TileSparkChanger extends TileSimpleInventory {
|
||||
|
||||
ItemStack changeStack = itemHandler.getStackInSlot(0);
|
||||
List<ISparkAttachable> attachables = new ArrayList<>();
|
||||
for(EnumFacing dir : LibMisc.CARDINAL_DIRECTIONS) {
|
||||
for(EnumFacing dir : EnumFacing.HORIZONTALS) {
|
||||
TileEntity tile = worldObj.getTileEntity(pos.offset(dir));
|
||||
if(tile != null && tile instanceof ISparkAttachable) {
|
||||
ISparkAttachable attach = (ISparkAttachable) tile;
|
||||
|
||||
@@ -50,7 +50,7 @@ public class TileCorporeaFunnel extends TileCorporeaBase implements ICorporeaReq
|
||||
1, 2, 4, 8, 16, 32, 48, 64
|
||||
};
|
||||
|
||||
for(EnumFacing dir : LibMisc.CARDINAL_DIRECTIONS) {
|
||||
for(EnumFacing dir : EnumFacing.HORIZONTALS) {
|
||||
List<EntityItemFrame> frames = worldObj.getEntitiesWithinAABB(EntityItemFrame.class, new AxisAlignedBB(pos.offset(dir), pos.offset(dir).add(1, 1, 1)));
|
||||
for(EntityItemFrame frame : frames) {
|
||||
EnumFacing orientation = frame.facingDirection;
|
||||
|
||||
+2
-2
@@ -57,7 +57,7 @@ public class TileCorporeaInterceptor extends TileCorporeaBase implements ICorpor
|
||||
worldObj.scheduleUpdate(getPos(), getBlockType(), 2);
|
||||
|
||||
TileEntity requestor = source.getSparkInventory().world.getTileEntity(source.getSparkInventory().pos);
|
||||
for(EnumFacing dir : LibMisc.CARDINAL_DIRECTIONS) {
|
||||
for(EnumFacing dir : EnumFacing.HORIZONTALS) {
|
||||
TileEntity tile = worldObj.getTileEntity(pos.offset(dir));
|
||||
if(tile != null && tile instanceof TileCorporeaRetainer)
|
||||
((TileCorporeaRetainer) tile).setPendingRequest(requestor.getPos(), request, count);
|
||||
@@ -85,7 +85,7 @@ public class TileCorporeaInterceptor extends TileCorporeaBase implements ICorpor
|
||||
public List<ItemStack> getFilter() {
|
||||
List<ItemStack> filter = new ArrayList<>();
|
||||
|
||||
for(EnumFacing dir : LibMisc.CARDINAL_DIRECTIONS) {
|
||||
for(EnumFacing dir : EnumFacing.HORIZONTALS) {
|
||||
List<EntityItemFrame> frames = worldObj.getEntitiesWithinAABB(EntityItemFrame.class, new AxisAlignedBB(pos.offset(dir), pos.offset(dir).add(1, 1, 1)));
|
||||
for(EntityItemFrame frame : frames) {
|
||||
EnumFacing orientation = frame.facingDirection;
|
||||
|
||||
@@ -30,7 +30,7 @@ public class TileDistributor extends TileMod implements IManaReceiver {
|
||||
if (worldObj.isRemote)
|
||||
return;
|
||||
validPools.clear();
|
||||
for(EnumFacing dir : LibMisc.CARDINAL_DIRECTIONS) {
|
||||
for(EnumFacing dir : EnumFacing.HORIZONTALS) {
|
||||
TileEntity tileAt = worldObj.getTileEntity(pos.offset(dir));
|
||||
if(tileAt != null && tileAt instanceof IManaPool && !tileAt.isInvalid()) {
|
||||
IManaReceiver receiver = (IManaReceiver) tileAt;
|
||||
|
||||
@@ -249,7 +249,7 @@ public class TilePool extends TileMod implements IManaPool, IDyablePool, IKeyLoc
|
||||
|
||||
int bellowCount = 0;
|
||||
if(outputting)
|
||||
for(EnumFacing dir : LibMisc.CARDINAL_DIRECTIONS) {
|
||||
for(EnumFacing dir : EnumFacing.HORIZONTALS) {
|
||||
TileEntity tile = worldObj.getTileEntity(pos.offset(dir));
|
||||
if(tile != null && tile instanceof TileBellows && ((TileBellows) tile).getLinkedTile() == this)
|
||||
bellowCount++;
|
||||
|
||||
@@ -23,7 +23,7 @@ public final class SpawnerChangingHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onInteract(PlayerInteractEvent event) {
|
||||
if(event.entityPlayer == null || event.entityPlayer.capabilities == null || event.world == null)
|
||||
/*if(event.entityPlayer == null || event.entityPlayer.capabilities == null || event.world == null) todo 1.9
|
||||
return; // Cauldron breaks stuff
|
||||
|
||||
if(event.entityPlayer.capabilities.isCreativeMode && !event.world.isRemote && event.action == Action.RIGHT_CLICK_BLOCK && !event.entityPlayer.isSneaking()) {
|
||||
@@ -37,7 +37,7 @@ public final class SpawnerChangingHandler {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,27 +3,36 @@ package vazkii.botania.common.core.helper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumHand;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public final class PlayerHelper {
|
||||
|
||||
// Checks if either of the player's hands has an item.
|
||||
public static boolean hasAnyHeldItem(EntityPlayer player) {
|
||||
return player.getHeldItemMainhand() != null || player.getHeldItemOffhand() != null;
|
||||
}
|
||||
|
||||
// Checks main hand, then off hand for this item.
|
||||
public static boolean hasHeldItem(EntityPlayer player, Item item) {
|
||||
return (player.getHeldItemMainhand() != null && player.getHeldItemMainhand().getItem() == item)
|
||||
|| (player.getHeldItemOffhand() != null && player.getHeldItemOffhand().getItem() == item);
|
||||
}
|
||||
|
||||
// Checks main hand, then off hand for this item class.
|
||||
public static boolean hasHeldItemClass(EntityPlayer player, Item template) {
|
||||
return hasHeldItemClass(player, template.getClass());
|
||||
}
|
||||
|
||||
// Checks main hand, then off hand for this item class.
|
||||
public static boolean hasHeldItemClass(EntityPlayer player, Class<?> template) {
|
||||
return (player.getHeldItemMainhand() != null && template.isAssignableFrom(player.getHeldItemMainhand().getItem().getClass()))
|
||||
|| (player.getHeldItemOffhand() != null && template.isAssignableFrom(player.getHeldItemOffhand().getItem().getClass()));
|
||||
}
|
||||
|
||||
// Checks main hand, then off hand for this item. Null otherwise.
|
||||
public static ItemStack getFirstHeldItem(EntityPlayer player, Item item) {
|
||||
ItemStack main = player.getHeldItemMainhand();
|
||||
ItemStack offhand = player.getHeldItemOffhand();
|
||||
@@ -34,6 +43,7 @@ public final class PlayerHelper {
|
||||
} else return null;
|
||||
}
|
||||
|
||||
// Checks main hand, then off hand for this item class. Null otherwise.
|
||||
public static ItemStack getFirstHeldItemClass(EntityPlayer player, Class<?> template) {
|
||||
ItemStack main = player.getHeldItemMainhand();
|
||||
ItemStack offhand = player.getHeldItemOffhand();
|
||||
@@ -44,5 +54,52 @@ public final class PlayerHelper {
|
||||
} else return null;
|
||||
}
|
||||
|
||||
public static ItemStack getAmmo(EntityPlayer player, Predicate<ItemStack> ammoFunc) {
|
||||
// Mainly from ItemBow.findAmmo
|
||||
if (ammoFunc.test(player.getHeldItem(EnumHand.OFF_HAND)))
|
||||
{
|
||||
return player.getHeldItem(EnumHand.OFF_HAND);
|
||||
}
|
||||
else if (ammoFunc.test(player.getHeldItem(EnumHand.MAIN_HAND)))
|
||||
{
|
||||
return player.getHeldItem(EnumHand.MAIN_HAND);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); ++i)
|
||||
{
|
||||
ItemStack itemstack = player.inventory.getStackInSlot(i);
|
||||
|
||||
if (ammoFunc.test(itemstack))
|
||||
{
|
||||
return itemstack;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean hasAmmo(EntityPlayer player, Predicate<ItemStack> ammoFunc) {
|
||||
return getAmmo(player, ammoFunc) != null;
|
||||
}
|
||||
|
||||
public static void consumeAmmo(EntityPlayer player, Predicate<ItemStack> ammoFunc) {
|
||||
ItemStack ammo = getAmmo(player, ammoFunc);
|
||||
if(ammo != null) {
|
||||
ammo.stackSize--;
|
||||
if(ammo.stackSize == 0)
|
||||
player.inventory.deleteStack(ammo);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean hasItem(EntityPlayer player, Predicate<ItemStack> itemFunc) {
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
|
||||
if (itemFunc.test(player.inventory.getStackInSlot(i)))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private PlayerHelper() {}
|
||||
}
|
||||
@@ -46,7 +46,7 @@ public class EntityCorporeaSpark extends Entity implements ICorporeaSpark {
|
||||
|
||||
private static final DataParameter<Boolean> MASTER = EntityDataManager.createKey(EntityCorporeaSpark.class, DataSerializers.BOOLEAN);
|
||||
private static final DataParameter<Integer> NETWORK = EntityDataManager.createKey(EntityCorporeaSpark.class, DataSerializers.VARINT);
|
||||
private static final DataParameter<Integer> INVISIBILITY = EntityDataManager.createKey(EntityCorporeaSpark.class, DataSerializers.VARINT);
|
||||
public static final DataParameter<Integer> INVISIBILITY = EntityDataManager.createKey(EntityCorporeaSpark.class, DataSerializers.VARINT);
|
||||
private static final DataParameter<Integer> ITEM_DISPLAY_TICKS = EntityDataManager.createKey(EntityCorporeaSpark.class, DataSerializers.VARINT);
|
||||
private static final DataParameter<Optional<ItemStack>> DISPLAY_STACK = EntityDataManager.createKey(EntityCorporeaSpark.class, DataSerializers.OPTIONAL_ITEM_STACK);
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.text.Style;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.BossInfo;
|
||||
import net.minecraft.world.EnumDifficulty;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
@@ -896,6 +897,16 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BossInfo getBossInfo() {
|
||||
return null; // todo 1.9
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityLivingBase getEntity() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBossBarShaderProgram(boolean background) {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
package vazkii.botania.common.entity;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.passive.EntityAmbientCreature;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
@@ -28,7 +29,7 @@ public class EntityFlyingCreature extends EntityAmbientCreature {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateFallState(double y, boolean onGround, Block block, BlockPos pos) {
|
||||
protected void updateFallState(double y, boolean onGround, IBlockState state, BlockPos pos) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,9 @@ import net.minecraft.entity.monster.IMob;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityThrowable;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.datasync.DataParameter;
|
||||
import net.minecraft.network.datasync.DataSerializers;
|
||||
import net.minecraft.network.datasync.EntityDataManager;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
@@ -34,6 +37,8 @@ import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
||||
public class EntityMagicMissile extends EntityThrowable {
|
||||
|
||||
private static final String TAG_TIME = "time";
|
||||
private static final DataParameter<Boolean> EVIL = EntityDataManager.createKey(EntityMagicMissile.class, DataSerializers.BOOLEAN);
|
||||
private static final DataParameter<Integer> TARGET = EntityDataManager.createKey(EntityMagicMissile.class, DataSerializers.VARINT);
|
||||
|
||||
double lockX, lockY = -1, lockZ;
|
||||
int time = 0;
|
||||
@@ -51,24 +56,24 @@ public class EntityMagicMissile extends EntityThrowable {
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
dataWatcher.addObject(25, (byte) 0);
|
||||
dataWatcher.addObject(26, 0);
|
||||
dataWatcher.register(EVIL, false);
|
||||
dataWatcher.register(TARGET, 0);
|
||||
}
|
||||
|
||||
public void setEvil(boolean evil) {
|
||||
dataWatcher.updateObject(25, (byte) (evil ? 1 : 0));
|
||||
dataWatcher.set(EVIL, evil);
|
||||
}
|
||||
|
||||
public boolean isEvil() {
|
||||
return dataWatcher.getWatchableObjectByte(25) == 1;
|
||||
return dataWatcher.get(EVIL);
|
||||
}
|
||||
|
||||
public void setTarget(EntityLivingBase e) {
|
||||
dataWatcher.updateObject(26, e == null ? -1 : e.getEntityId());
|
||||
dataWatcher.set(TARGET, e == null ? -1 : e.getEntityId());
|
||||
}
|
||||
|
||||
public EntityLivingBase getTargetEntity() {
|
||||
int id = dataWatcher.getWatchableObjectInt(26);
|
||||
int id = dataWatcher.get(TARGET);
|
||||
Entity e = worldObj.getEntityByID(id);
|
||||
if(e != null && e instanceof EntityLivingBase)
|
||||
return (EntityLivingBase) e;
|
||||
|
||||
@@ -88,7 +88,7 @@ public class EntityPoolMinecart extends EntityMinecart {
|
||||
public void moveMinecartOnRail(BlockPos pos) {
|
||||
super.moveMinecartOnRail(pos);
|
||||
|
||||
for(EnumFacing dir : LibMisc.CARDINAL_DIRECTIONS) {
|
||||
for(EnumFacing dir : EnumFacing.HORIZONTALS) {
|
||||
BlockPos posP = pos.offset(dir);
|
||||
Block block = worldObj.getBlockState(posP).getBlock();
|
||||
if(block == ModBlocks.pump) {
|
||||
|
||||
@@ -49,7 +49,7 @@ public class EntitySpark extends Entity implements ISparkEntity {
|
||||
private static final int TRANSFER_RATE = 1000;
|
||||
private static final String TAG_UPGRADE = "upgrade";
|
||||
private static final String TAG_INVIS = "invis";
|
||||
private static final DataParameter<Integer> INVISIBILITY = EntityDataManager.createKey(EntitySpark.class, DataSerializers.VARINT);
|
||||
public static final DataParameter<Integer> INVISIBILITY = EntityDataManager.createKey(EntitySpark.class, DataSerializers.VARINT);
|
||||
private static final DataParameter<Integer> UPGRADE = EntityDataManager.createKey(EntitySpark.class, DataSerializers.VARINT);
|
||||
|
||||
Set<ISparkEntity> transfers = Collections.newSetFromMap(new WeakHashMap<>());
|
||||
|
||||
@@ -34,6 +34,7 @@ import vazkii.botania.api.mana.BurstProperties;
|
||||
import vazkii.botania.api.mana.ILaputaImmobile;
|
||||
import vazkii.botania.api.mana.ILensEffect;
|
||||
import vazkii.botania.api.mana.ITinyPlanetExcempt;
|
||||
import vazkii.botania.api.sound.BotaniaSoundEvents;
|
||||
import vazkii.botania.common.achievement.ModAchievements;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
import vazkii.botania.common.core.helper.MathHelper;
|
||||
@@ -77,16 +78,16 @@ public class ItemLaputaShard extends ItemMod implements ILensEffect, ITinyPlanet
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, BlockPos pos, EnumFacing side, float par8, float par9, float par10) {
|
||||
public EnumActionResult onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, BlockPos pos, EnumHand hand, EnumFacing side, float par8, float par9, float par10) {
|
||||
if(!par3World.isRemote && pos.getY() < 160 && !par3World.provider.doesWaterVaporize()) {
|
||||
par3World.playSound(pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D, "botania:laputaStart", 1.0F + par3World.rand.nextFloat(), par3World.rand.nextFloat() * 0.7F + 1.3F, false);
|
||||
par3World.playSound(null, pos, BotaniaSoundEvents.laputaStart, SoundCategory.BLOCKS, 1.0F + par3World.rand.nextFloat(), par3World.rand.nextFloat() * 0.7F + 1.3F);
|
||||
spawnBurstFirst(par3World, pos, par1ItemStack);
|
||||
par1ItemStack.stackSize--;
|
||||
if(par1ItemStack.getItemDamage() == 19)
|
||||
par2EntityPlayer.addStat(ModAchievements.l20ShardUse, 1);
|
||||
}
|
||||
|
||||
return true;
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
public void spawnBurstFirst(World world, BlockPos pos, ItemStack lens) {
|
||||
@@ -122,10 +123,10 @@ public class ItemLaputaShard extends ItemMod implements ILensEffect, ITinyPlanet
|
||||
BlockPos pos_ = pos.add(-range + i, -BASE_RANGE + j, -range + k);
|
||||
|
||||
if(inRange(pos_, pos, range, heightscale, pointy)) {
|
||||
Block block = world.getBlockState(pos_).getBlock();
|
||||
if(!block.isAir(world, pos_) && !block.isReplaceable(world, pos_) && !(block instanceof BlockFalling) && (!(block instanceof ILaputaImmobile) || ((ILaputaImmobile) block).canMove(world, pos_)) && block.getBlockHardness(world, pos_) != -1) {
|
||||
IBlockState state = world.getBlockState(pos_);
|
||||
Block block = state.getBlock();
|
||||
if(!block.isAir(state, world, pos_) && !block.isReplaceable(world, pos_) && !(block instanceof BlockFalling) && (!(block instanceof ILaputaImmobile) || ((ILaputaImmobile) block).canMove(world, pos_)) && state.getBlockHardness(world, pos_) != -1) {
|
||||
int id = Block.getIdFromBlock(block);
|
||||
IBlockState state = world.getBlockState(pos_);
|
||||
TileEntity tile = world.getTileEntity(pos_);
|
||||
|
||||
if(tile != null) {
|
||||
@@ -244,7 +245,7 @@ public class ItemLaputaShard extends ItemMod implements ILensEffect, ITinyPlanet
|
||||
TileEntity tile = null;
|
||||
NBTTagCompound tilecmp = ItemNBTHelper.getCompound(lens, TAG_TILE, false);
|
||||
if(tilecmp.hasKey("id"))
|
||||
tile = TileEntity.createAndLoadEntity(tilecmp);
|
||||
tile = TileEntity.createTileEntity(null, tilecmp);
|
||||
|
||||
entity.worldObj.setBlockState(pos, block.getStateFromMeta(meta), 1 | 2);
|
||||
entity.worldObj.playAuxSFX(2001, pos, Block.getStateId(block.getStateFromMeta(meta)));
|
||||
|
||||
@@ -25,6 +25,7 @@ import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.text.Style;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
@@ -35,10 +36,12 @@ import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.KnowledgeType;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.recipe.IElvenItem;
|
||||
import vazkii.botania.api.sound.BotaniaSoundEvents;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.achievement.ModAchievements;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
import vazkii.botania.common.core.helper.MathHelper;
|
||||
import vazkii.botania.common.core.helper.PlayerHelper;
|
||||
import vazkii.botania.common.item.relic.ItemDice;
|
||||
import vazkii.botania.common.lib.LibGuiIDs;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
@@ -58,7 +61,7 @@ public class ItemLexicon extends ItemMod implements ILexicon, IElvenItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, BlockPos pos, EnumFacing side, float par8, float par9, float par10) {
|
||||
public EnumActionResult onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, BlockPos pos, EnumHand hand, EnumFacing side, float par8, float par9, float par10) {
|
||||
if(par2EntityPlayer.isSneaking()) {
|
||||
Block block = par3World.getBlockState(pos).getBlock();
|
||||
|
||||
@@ -70,16 +73,16 @@ public class ItemLexicon extends ItemMod implements ILexicon, IElvenItem {
|
||||
Botania.proxy.setLexiconStack(par1ItemStack);
|
||||
|
||||
openBook(par2EntityPlayer, par1ItemStack, par3World, false);
|
||||
return true;
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
} else if(par3World.isRemote) {
|
||||
RayTraceResult mop = new RayTraceResult(new Vec3d(par8, par9, par10), side, pos);
|
||||
return Botania.proxy.openWikiPage(par3World, block, mop);
|
||||
return Botania.proxy.openWikiPage(par3World, block, mop) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return EnumActionResult.PASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -127,7 +130,7 @@ public class ItemLexicon extends ItemMod implements ILexicon, IElvenItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
public ActionResult<ItemStack> onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, EnumHand hand) {
|
||||
String force = getForcedPage(par1ItemStack);
|
||||
if(force != null && !force.isEmpty()) {
|
||||
LexiconEntry entry = getEntryFromForce(par1ItemStack);
|
||||
@@ -140,7 +143,7 @@ public class ItemLexicon extends ItemMod implements ILexicon, IElvenItem {
|
||||
openBook(par3EntityPlayer, par1ItemStack, par2World, skipSound);
|
||||
skipSound = false;
|
||||
|
||||
return par1ItemStack;
|
||||
return ActionResult.newResult(EnumActionResult.SUCCESS, par1ItemStack);
|
||||
}
|
||||
|
||||
public static void openBook(EntityPlayer player, ItemStack stack, World world, boolean skipSound) {
|
||||
@@ -151,7 +154,7 @@ public class ItemLexicon extends ItemMod implements ILexicon, IElvenItem {
|
||||
if(!l.isKnowledgeUnlocked(stack, BotaniaAPI.relicKnowledge) && l.isKnowledgeUnlocked(stack, BotaniaAPI.elvenKnowledge))
|
||||
for(ItemStack rstack : ItemDice.relicStacks) {
|
||||
Item item = rstack.getItem();
|
||||
if(player.inventory.hasItem(item)) {
|
||||
if(PlayerHelper.hasItem(player, s -> s != null && s.getItem() == item)) {
|
||||
l.unlockKnowledge(stack, BotaniaAPI.relicKnowledge);
|
||||
break;
|
||||
}
|
||||
@@ -161,7 +164,7 @@ public class ItemLexicon extends ItemMod implements ILexicon, IElvenItem {
|
||||
player.addStat(ModAchievements.lexiconUse, 1);
|
||||
player.openGui(Botania.instance, LibGuiIDs.LEXICON, world, 0, 0, 0);
|
||||
if(!world.isRemote && !skipSound)
|
||||
world.playSoundAtEntity(player, "botania:lexiconOpen", 0.5F, 1F);
|
||||
world.playSound(null, player.posX, player.posY, player.posZ, BotaniaSoundEvents.lexiconOpen, SoundCategory.PLAYERS, 0.5F, 1F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -170,7 +173,7 @@ public class ItemLexicon extends ItemMod implements ILexicon, IElvenItem {
|
||||
if(ticks > 0 && entity instanceof EntityPlayer) {
|
||||
skipSound = ticks < 5;
|
||||
if(ticks == 1)
|
||||
onItemRightClick(stack, world, (EntityPlayer) entity);
|
||||
onItemRightClick(stack, world, (EntityPlayer) entity, EnumHand.MAIN_HAND);
|
||||
|
||||
setQueueTicks(stack, ticks - 1);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
@@ -25,6 +26,7 @@ import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraft.world.World;
|
||||
@@ -34,6 +36,7 @@ import vazkii.botania.api.mana.BurstProperties;
|
||||
import vazkii.botania.api.mana.ILens;
|
||||
import vazkii.botania.api.mana.IManaUsingItem;
|
||||
import vazkii.botania.api.mana.ManaItemHandler;
|
||||
import vazkii.botania.api.sound.BotaniaSoundEvents;
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
import vazkii.botania.client.core.handler.ItemsRemainingRenderHandler;
|
||||
import vazkii.botania.common.achievement.ModAchievements;
|
||||
@@ -80,7 +83,7 @@ public class ItemManaGun extends ItemMod implements IManaUsingItem, IColorable {
|
||||
|
||||
if(par3EntityPlayer.isSneaking() && hasClip(par1ItemStack)) {
|
||||
rotatePos(par1ItemStack);
|
||||
par2World.playSoundAtEntity(par3EntityPlayer, "random.click", 0.6F, (1.0F + (par2World.rand.nextFloat() - par2World.rand.nextFloat()) * 0.2F) * 0.7F);
|
||||
par2World.playSound(null, par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ, SoundEvents.block_stone_button_click_on, SoundCategory.PLAYERS, 0.6F, (1.0F + (par2World.rand.nextFloat() - par2World.rand.nextFloat()) * 0.2F) * 0.7F);
|
||||
if(par2World.isRemote)
|
||||
par3EntityPlayer.swingArm(hand);
|
||||
ItemStack lens = getLens(par1ItemStack);
|
||||
@@ -90,7 +93,7 @@ public class ItemManaGun extends ItemMod implements IManaUsingItem, IColorable {
|
||||
EntityManaBurst burst = getBurst(par3EntityPlayer, par1ItemStack, true);
|
||||
if(burst != null && ManaItemHandler.requestManaExact(par1ItemStack, par3EntityPlayer, burst.getMana(), true)) {
|
||||
if(!par2World.isRemote) {
|
||||
par2World.playSoundAtEntity(par3EntityPlayer, "botania:manaBlaster", 0.6F, 1F);
|
||||
par2World.playSound(null, par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ, BotaniaSoundEvents.manaBlaster, SoundCategory.PLAYERS, 0.6F, 1);
|
||||
par3EntityPlayer.addStat(ModAchievements.manaBlasterShoot, 1);
|
||||
if(isSugoiKawaiiDesuNe(par1ItemStack))
|
||||
par3EntityPlayer.addStat(ModAchievements.desuGun, 1);
|
||||
@@ -103,7 +106,7 @@ public class ItemManaGun extends ItemMod implements IManaUsingItem, IColorable {
|
||||
}
|
||||
par1ItemStack.setItemDamage(effCd);
|
||||
} else if(!par2World.isRemote)
|
||||
par2World.playSoundAtEntity(par3EntityPlayer, "random.click", 0.6F, (1.0F + (par2World.rand.nextFloat() - par2World.rand.nextFloat()) * 0.2F) * 0.7F);
|
||||
par2World.playSound(null, par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ, SoundEvents.block_lever_click, SoundCategory.PLAYERS, 0.6F, (1.0F + (par2World.rand.nextFloat() - par2World.rand.nextFloat()) * 0.2F) * 0.7F);
|
||||
}
|
||||
|
||||
return ActionResult.newResult(EnumActionResult.SUCCESS, par1ItemStack);
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
package vazkii.botania.common.item;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.oredict.RecipeSorter;
|
||||
import net.minecraftforge.oredict.RecipeSorter.Category;
|
||||
import vazkii.botania.api.mana.ManaItemHandler;
|
||||
@@ -33,7 +34,7 @@ public class ItemRegenIvy extends ItemMod {
|
||||
setUnlocalizedName(LibItemNames.REGEN_IVY);
|
||||
GameRegistry.addRecipe(new RegenIvyRecipe());
|
||||
RecipeSorter.register("botania:regenIvy", RegenIvyRecipe.class, Category.SHAPELESS, "");
|
||||
FMLCommonHandler.instance().bus().register(this);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||
|
||||
@@ -31,6 +31,7 @@ import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import vazkii.botania.common.achievement.ModAchievements;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
import vazkii.botania.common.entity.EntitySignalFlare;
|
||||
@@ -70,7 +71,7 @@ public class ItemSignalFlare extends ItemMod implements IColorable {
|
||||
int range = 5;
|
||||
List<EntityLivingBase> entities = par2World.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(par3EntityPlayer.posX - range, par3EntityPlayer.posY - range, par3EntityPlayer.posZ - range, par3EntityPlayer.posX + range, par3EntityPlayer.posY + range, par3EntityPlayer.posZ + range));
|
||||
for(EntityLivingBase entity : entities)
|
||||
if(entity != par3EntityPlayer && (!(entity instanceof EntityPlayer) || MinecraftServer.getServer() == null || MinecraftServer.getServer().isPVPEnabled())) {
|
||||
if(entity != par3EntityPlayer && (!(entity instanceof EntityPlayer) || FMLCommonHandler.instance().getMinecraftServerInstance() == null || FMLCommonHandler.instance().getMinecraftServerInstance().isPVPEnabled())) {
|
||||
entity.addPotionEffect(new PotionEffect(MobEffects.moveSlowdown, 50, 5));
|
||||
stunned++;
|
||||
}
|
||||
|
||||
@@ -18,11 +18,16 @@ import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.common.core.helper.PlayerHelper;
|
||||
import vazkii.botania.common.entity.EntityVineBall;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class ItemSlingshot extends ItemMod {
|
||||
|
||||
private static final Predicate<ItemStack> AMMO_FUNC = s -> s != null && s.getItem() == ModItems.vineBall;
|
||||
|
||||
public ItemSlingshot() {
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName(LibItemNames.SLINGSHOT);
|
||||
@@ -32,7 +37,7 @@ public class ItemSlingshot extends ItemMod {
|
||||
public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityLivingBase living, int par4) {
|
||||
int j = getMaxItemUseDuration(par1ItemStack) - par4;
|
||||
|
||||
if(!(living instanceof EntityPlayer) || ((EntityPlayer) living).capabilities.isCreativeMode || ((EntityPlayer) living).inventory.hasItem(ModItems.vineBall)) {
|
||||
if(!(living instanceof EntityPlayer) || ((EntityPlayer) living).capabilities.isCreativeMode || PlayerHelper.hasAmmo(((EntityPlayer) living), AMMO_FUNC)) {
|
||||
float f = j / 20.0F;
|
||||
f = (f * f + f * 2.0F) / 3.0F;
|
||||
|
||||
@@ -40,7 +45,7 @@ public class ItemSlingshot extends ItemMod {
|
||||
return;
|
||||
|
||||
if(living instanceof EntityPlayer && !((EntityPlayer) living).capabilities.isCreativeMode)
|
||||
((EntityPlayer) living).inventory.consumeInventoryItem(ModItems.vineBall);
|
||||
PlayerHelper.consumeAmmo(((EntityPlayer) living), AMMO_FUNC);
|
||||
|
||||
if(!par2World.isRemote) {
|
||||
EntityVineBall ball = new EntityVineBall(living, false);
|
||||
@@ -69,7 +74,7 @@ public class ItemSlingshot extends ItemMod {
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, EnumHand hand) {
|
||||
if(par3EntityPlayer.capabilities.isCreativeMode || par3EntityPlayer.inventory.hasItem(ModItems.vineBall)) {
|
||||
if(par3EntityPlayer.capabilities.isCreativeMode || PlayerHelper.hasAmmo(par3EntityPlayer, AMMO_FUNC)) {
|
||||
par3EntityPlayer.setActiveHand(hand);
|
||||
return ActionResult.newResult(EnumActionResult.SUCCESS, par1ItemStack);
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public class ItemTwigWand extends Item16Colors implements ICoordBoundItem {
|
||||
setBoundTile(par1ItemStack, UNBOUND_POS);
|
||||
}
|
||||
|
||||
return true;
|
||||
return EnumActionResult.SUCCESS;
|
||||
} else setBoundTile(par1ItemStack, UNBOUND_POS);
|
||||
} else if(par2EntityPlayer.isSneaking()) {
|
||||
block.rotateBlock(par3World, pos, side);
|
||||
@@ -132,7 +132,7 @@ public class ItemTwigWand extends Item16Colors implements ICoordBoundItem {
|
||||
par2EntityPlayer.swingArm(hand);
|
||||
}
|
||||
|
||||
return wanded;
|
||||
return wanded ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
|
||||
} else if(BlockPistonRelay.playerPositions.containsKey(par2EntityPlayer.getName()) && !par3World.isRemote) {
|
||||
BlockPistonRelay.DimWithPos bindPos = BlockPistonRelay.playerPositions.get(par2EntityPlayer.getName());
|
||||
BlockPistonRelay.DimWithPos currentPos = new BlockPistonRelay.DimWithPos(par3World.provider.getDimension(), pos);
|
||||
@@ -142,9 +142,10 @@ public class ItemTwigWand extends Item16Colors implements ICoordBoundItem {
|
||||
BlockPistonRelay.WorldData.get(par3World).markDirty();
|
||||
|
||||
par3World.playSound(null, par2EntityPlayer.posX, par2EntityPlayer.posY, par2EntityPlayer.posZ, BotaniaSoundEvents.ding, SoundCategory.PLAYERS, 1F, 1F);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
return false;
|
||||
return EnumActionResult.PASS;
|
||||
}
|
||||
|
||||
public static void doParticleBeam(World world, Vector3 orig, Vector3 end) {
|
||||
|
||||
+5
-5
@@ -25,14 +25,14 @@ public abstract class ItemElementiumArmor extends ItemManasteelArmor implements
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelBiped provideArmorModelForSlot(ItemStack stack, int slot) {
|
||||
models[slot] = new ModelArmorElementium(slot);
|
||||
return models[slot];
|
||||
public ModelBiped provideArmorModelForSlot(ItemStack stack, EntityEquipmentSlot slot) {
|
||||
models.put(slot, new ModelArmorElementium(slot));
|
||||
return models.get(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArmorTextureAfterInk(ItemStack stack, int slot) {
|
||||
return ConfigHandler.enableArmorModels ? LibResources.MODEL_ELEMENTIUM_NEW : slot == 2 ? LibResources.MODEL_ELEMENTIUM_1 : LibResources.MODEL_ELEMENTIUM_0;
|
||||
public String getArmorTextureAfterInk(ItemStack stack, EntityEquipmentSlot slot) {
|
||||
return ConfigHandler.enableArmorModels ? LibResources.MODEL_ELEMENTIUM_NEW : slot == EntityEquipmentSlot.LEGS ? LibResources.MODEL_ELEMENTIUM_1 : LibResources.MODEL_ELEMENTIUM_0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-1
@@ -1,12 +1,13 @@
|
||||
package vazkii.botania.common.item.equipment.armor.elementium;
|
||||
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
|
||||
public class ItemElementiumBoots extends ItemElementiumArmor {
|
||||
|
||||
public ItemElementiumBoots() {
|
||||
super(3, LibItemNames.ELEMENTIUM_BOOTS);
|
||||
super(EntityEquipmentSlot.FEET, LibItemNames.ELEMENTIUM_BOOTS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-1
@@ -1,12 +1,13 @@
|
||||
package vazkii.botania.common.item.equipment.armor.elementium;
|
||||
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
|
||||
public class ItemElementiumChest extends ItemElementiumArmor {
|
||||
|
||||
public ItemElementiumChest() {
|
||||
super(1, LibItemNames.ELEMENTIUM_CHEST);
|
||||
super(EntityEquipmentSlot.CHEST, LibItemNames.ELEMENTIUM_CHEST);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
package vazkii.botania.common.item.equipment.armor.elementium;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.mana.IManaDiscountArmor;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
@@ -12,7 +13,7 @@ public class ItemElementiumHelm extends ItemElementiumArmor implements IManaDisc
|
||||
}
|
||||
|
||||
public ItemElementiumHelm(String name) {
|
||||
super(0, name);
|
||||
super(EntityEquipmentSlot.HEAD, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-1
@@ -1,12 +1,13 @@
|
||||
package vazkii.botania.common.item.equipment.armor.elementium;
|
||||
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
|
||||
public class ItemElementiumLegs extends ItemElementiumArmor {
|
||||
|
||||
public ItemElementiumLegs() {
|
||||
super(2, LibItemNames.ELEMENTIUM_LEGS);
|
||||
super(EntityEquipmentSlot.LEGS, LibItemNames.ELEMENTIUM_LEGS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+13
-12
@@ -10,7 +10,9 @@
|
||||
*/
|
||||
package vazkii.botania.common.item.equipment.armor.manasteel;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
@@ -50,7 +52,7 @@ public class ItemManasteelArmor extends ItemArmor implements ISpecialArmor, IMan
|
||||
|
||||
private static final String TAG_PHANTOM_INK = "phantomInk";
|
||||
|
||||
protected ModelBiped[] models = null;
|
||||
protected Map<EntityEquipmentSlot, ModelBiped> models = null;
|
||||
public EntityEquipmentSlot type;
|
||||
|
||||
public ItemManasteelArmor(EntityEquipmentSlot type, String name) {
|
||||
@@ -105,19 +107,18 @@ public class ItemManasteelArmor extends ItemArmor implements ISpecialArmor, IMan
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
|
||||
public final String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) {
|
||||
return hasPhantomInk(stack) ? LibResources.MODEL_INVISIBLE_ARMOR : getArmorTextureAfterInk(stack, slot);
|
||||
}
|
||||
|
||||
public String getArmorTextureAfterInk(ItemStack stack, int slot) {
|
||||
return ConfigHandler.enableArmorModels ? LibResources.MODEL_MANASTEEL_NEW : slot == 2 ? LibResources.MODEL_MANASTEEL_1 : LibResources.MODEL_MANASTEEL_0;
|
||||
public String getArmorTextureAfterInk(ItemStack stack, EntityEquipmentSlot slot) {
|
||||
return ConfigHandler.enableArmorModels ? LibResources.MODEL_MANASTEEL_NEW : slot == EntityEquipmentSlot.LEGS ? LibResources.MODEL_MANASTEEL_1 : LibResources.MODEL_MANASTEEL_0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot, ModelBiped original) {
|
||||
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped original) {
|
||||
if(ConfigHandler.enableArmorModels) {
|
||||
armorSlot--; // 1.8: mojang is dumb and made armorSlot 1-4 instead of 0-3.
|
||||
ModelBiped model = getArmorModelForSlot(entityLiving, itemStack, armorSlot);
|
||||
if(model == null)
|
||||
model = provideArmorModelForSlot(itemStack, armorSlot);
|
||||
@@ -132,17 +133,17 @@ public class ItemManasteelArmor extends ItemArmor implements ISpecialArmor, IMan
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelBiped getArmorModelForSlot(EntityLivingBase entity, ItemStack stack, int slot) {
|
||||
public ModelBiped getArmorModelForSlot(EntityLivingBase entity, ItemStack stack, EntityEquipmentSlot slot) {
|
||||
if(models == null)
|
||||
models = new ModelBiped[4];
|
||||
models = new EnumMap<>(EntityEquipmentSlot.class);
|
||||
|
||||
return models[slot];
|
||||
return models.get(slot);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelBiped provideArmorModelForSlot(ItemStack stack, int slot) {
|
||||
models[slot] = new ModelArmorManasteel(slot);
|
||||
return models[slot];
|
||||
public ModelBiped provideArmorModelForSlot(ItemStack stack, EntityEquipmentSlot slot) {
|
||||
models.put(slot, new ModelArmorManasteel(slot));
|
||||
return models.get(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+5
-5
@@ -39,14 +39,14 @@ public class ItemManaweaveArmor extends ItemManasteelArmor implements ICraftAchi
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelBiped provideArmorModelForSlot(ItemStack stack, int slot) {
|
||||
models[slot] = new ModelArmorManaweave(slot);
|
||||
return models[slot];
|
||||
public ModelBiped provideArmorModelForSlot(ItemStack stack, EntityEquipmentSlot slot) {
|
||||
models.put(slot, new ModelArmorManaweave(slot));
|
||||
return models.get(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArmorTextureAfterInk(ItemStack stack, int slot) {
|
||||
return ConfigHandler.enableArmorModels ? (ClientProxy.jingleTheBells ? LibResources.MODEL_MANAWEAVE_NEW_HOLIDAY : LibResources.MODEL_MANAWEAVE_NEW) : slot == 2 ? LibResources.MODEL_MANAWEAVE_1 : LibResources.MODEL_MANAWEAVE_0;
|
||||
public String getArmorTextureAfterInk(ItemStack stack, EntityEquipmentSlot slot) {
|
||||
return ConfigHandler.enableArmorModels ? (ClientProxy.jingleTheBells ? LibResources.MODEL_MANAWEAVE_NEW_HOLIDAY : LibResources.MODEL_MANAWEAVE_NEW) : slot == EntityEquipmentSlot.LEGS ? LibResources.MODEL_MANAWEAVE_1 : LibResources.MODEL_MANAWEAVE_0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+5
-5
@@ -40,14 +40,14 @@ public class ItemTerrasteelArmor extends ItemManasteelArmor {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelBiped provideArmorModelForSlot(ItemStack stack, int slot) {
|
||||
models[slot] = new ModelArmorTerrasteel(slot);
|
||||
return models[slot];
|
||||
public ModelBiped provideArmorModelForSlot(ItemStack stack, EntityEquipmentSlot slot) {
|
||||
models.put(slot, new ModelArmorTerrasteel(slot));
|
||||
return models.get(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArmorTextureAfterInk(ItemStack stack, int slot) {
|
||||
return ConfigHandler.enableArmorModels ? LibResources.MODEL_TERRASTEEL_NEW : slot == 2 ? LibResources.MODEL_TERRASTEEL_1 : LibResources.MODEL_TERRASTEEL_0;
|
||||
public String getArmorTextureAfterInk(ItemStack stack, EntityEquipmentSlot slot) {
|
||||
return ConfigHandler.enableArmorModels ? LibResources.MODEL_TERRASTEEL_NEW : slot == EntityEquipmentSlot.CHEST ? LibResources.MODEL_TERRASTEEL_1 : LibResources.MODEL_TERRASTEEL_0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -353,10 +353,10 @@ public class ItemBaubleCosmetic extends ItemBauble implements ICosmeticBauble {
|
||||
|
||||
for (EnumFacing enumfacing : EnumFacing.values())
|
||||
{
|
||||
this.renderQuads(worldrenderer, model.getFaceQuads(enumfacing), color, stack);
|
||||
this.renderQuads(worldrenderer, model.getQuads(null, enumfacing, 0), color, stack);
|
||||
}
|
||||
|
||||
this.renderQuads(worldrenderer, model.getGeneralQuads(), color, stack);
|
||||
this.renderQuads(worldrenderer, model.getQuads(null, null, 0), color, stack);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
@@ -368,12 +368,12 @@ public class ItemBaubleCosmetic extends ItemBauble implements ICosmeticBauble {
|
||||
|
||||
for (int j = quads.size(); i < j; ++i)
|
||||
{
|
||||
BakedQuad bakedquad = (BakedQuad)quads.get(i);
|
||||
BakedQuad bakedquad = quads.get(i);
|
||||
int k = color;
|
||||
|
||||
if (flag && bakedquad.hasTintIndex())
|
||||
{
|
||||
k = stack.getItem().getColorFromItemStack(stack, bakedquad.getTintIndex());
|
||||
k = Minecraft.getMinecraft().getItemColors().getColorFromItemstack(stack, bakedquad.getTintIndex());
|
||||
|
||||
if (EntityRenderer.anaglyphEnable)
|
||||
{
|
||||
|
||||
@@ -108,9 +108,20 @@ public class ItemItemFinder extends ItemBauble implements IBaubleRender {
|
||||
}
|
||||
|
||||
public void tickServer(ItemStack stack, EntityPlayer player) {
|
||||
ItemStack pstack = player.getCurrentEquippedItem();
|
||||
StringBuilder positionsBuilder = new StringBuilder();
|
||||
|
||||
scanForStack(player.getHeldItemMainhand(), player, positionsBuilder);
|
||||
scanForStack(player.getHeldItemOffhand(), player, positionsBuilder);
|
||||
|
||||
String current = ItemNBTHelper.getString(stack, TAG_POSITIONS, "");
|
||||
String positions = positionsBuilder.toString();
|
||||
if(!current.equals(positions)) {
|
||||
ItemNBTHelper.setString(stack, TAG_POSITIONS, positions);
|
||||
PacketHandler.INSTANCE.sendToAll(new PacketSyncBauble(player, 0));
|
||||
}
|
||||
}
|
||||
|
||||
private void scanForStack(ItemStack pstack, EntityPlayer player, StringBuilder positionsBuilder) {
|
||||
if(pstack != null || player.isSneaking()) {
|
||||
int range = 24;
|
||||
|
||||
@@ -155,7 +166,10 @@ public class ItemItemFinder extends ItemBauble implements IBaubleRender {
|
||||
|
||||
} else if(e instanceof EntityLivingBase) {
|
||||
EntityLivingBase living = (EntityLivingBase) e;
|
||||
ItemStack estack = living.getEquipmentInSlot(0);
|
||||
ItemStack estack = living.getHeldItemMainhand();
|
||||
if(pstack != null && estack != null && equalStacks(estack, pstack))
|
||||
positionsBuilder.append(living.getEntityId()).append(";");
|
||||
estack = living.getHeldItemOffhand();
|
||||
if(pstack != null && estack != null && equalStacks(estack, pstack))
|
||||
positionsBuilder.append(living.getEntityId()).append(";");
|
||||
}
|
||||
@@ -188,20 +202,13 @@ public class ItemItemFinder extends ItemBauble implements IBaubleRender {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String current = ItemNBTHelper.getString(stack, TAG_POSITIONS, "");
|
||||
String positions = positionsBuilder.toString();
|
||||
if(!current.equals(positions)) {
|
||||
ItemNBTHelper.setString(stack, TAG_POSITIONS, positions);
|
||||
PacketHandler.INSTANCE.sendToAll(new PacketSyncBauble(player, 0));
|
||||
}
|
||||
}
|
||||
|
||||
boolean equalStacks(ItemStack stack1, ItemStack stack2) {
|
||||
private boolean equalStacks(ItemStack stack1, ItemStack stack2) {
|
||||
return stack1.isItemEqual(stack2) && ItemStack.areItemStackTagsEqual(stack1, stack2);
|
||||
}
|
||||
|
||||
boolean scanInventory(IItemHandler inv, ItemStack pstack) {
|
||||
private boolean scanInventory(IItemHandler inv, ItemStack pstack) {
|
||||
if(pstack == null)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -10,17 +10,12 @@
|
||||
*/
|
||||
package vazkii.botania.common.item.equipment.tool.bow;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.init.Enchantments;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameData;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.mana.ManaItemHandler;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
|
||||
@@ -43,40 +38,16 @@ public class ItemCrystalBow extends ItemLivingwoodBow {
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean canFire(ItemStack p_77615_1_, World p_77615_2_, EntityPlayer p_77615_3_, int p_77615_4_) {
|
||||
int infinity = EnchantmentHelper.getEnchantmentLevel(Enchantments.infinity, p_77615_1_);
|
||||
return ManaItemHandler.requestManaExactForTool(p_77615_1_, p_77615_3_, ARROW_COST / (infinity + 1), false);
|
||||
boolean canFire(ItemStack stack, EntityPlayer player) {
|
||||
int infinity = EnchantmentHelper.getEnchantmentLevel(Enchantments.infinity, stack);
|
||||
return ManaItemHandler.requestManaExactForTool(stack, player, ARROW_COST / (infinity + 1), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
void onFire(ItemStack p_77615_1_, World p_77615_2_, EntityPlayer p_77615_3_, int p_77615_4_, boolean infinity, EntityArrow arrow) {
|
||||
void onFire(ItemStack stack, EntityLivingBase living, boolean infinity, EntityArrow arrow) {
|
||||
arrow.canBePickedUp = EntityArrow.PickupStatus.CREATIVE_ONLY;
|
||||
ManaItemHandler.requestManaExactForTool(p_77615_1_, p_77615_3_, ARROW_COST / (infinity ? 2 : 1), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
||||
String name = GameData.getItemRegistry().getNameForObject(this).toString();
|
||||
|
||||
if (useRemaining == 0) {
|
||||
return new ModelResourceLocation(name, "inventory");
|
||||
}
|
||||
|
||||
int j = (int) ((getMaxItemUseDuration(stack) - useRemaining) * chargeVelocityMultiplier());
|
||||
|
||||
if(j >= 18)
|
||||
return new ModelResourceLocation(name + "_pulling_5", "inventory");
|
||||
if(j >= 15)
|
||||
return new ModelResourceLocation(name + "_pulling_4", "inventory");
|
||||
if(j >= 12)
|
||||
return new ModelResourceLocation(name + "_pulling_3", "inventory");
|
||||
if(j > 9)
|
||||
return new ModelResourceLocation(name + "_pulling_2", "inventory");
|
||||
if(j > 6)
|
||||
return new ModelResourceLocation(name + "_pulling_1", "inventory");
|
||||
|
||||
return new ModelResourceLocation(name, "inventory");
|
||||
if(living instanceof EntityPlayer)
|
||||
ManaItemHandler.requestManaExactForTool(stack, ((EntityPlayer) living), ARROW_COST / (infinity ? 2 : 1), false);
|
||||
}
|
||||
|
||||
}
|
||||
+55
-64
@@ -10,34 +10,42 @@
|
||||
*/
|
||||
package vazkii.botania.common.item.equipment.tool.bow;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.init.Enchantments;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArrow;
|
||||
import net.minecraft.item.ItemBow;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
import net.minecraftforge.event.entity.player.ArrowLooseEvent;
|
||||
import net.minecraftforge.event.entity.player.ArrowNockEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameData;
|
||||
import vazkii.botania.api.mana.IManaUsingItem;
|
||||
import vazkii.botania.api.mana.ManaItemHandler;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.core.BotaniaCreativeTab;
|
||||
import vazkii.botania.common.core.helper.PlayerHelper;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.equipment.tool.ToolCommons;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class ItemLivingwoodBow extends ItemBow implements IManaUsingItem {
|
||||
|
||||
private static final Predicate<ItemStack> AMMO_FUNC = s -> s != null && s.getItem() instanceof ItemArrow;
|
||||
public static final int MANA_PER_DAMAGE = 40;
|
||||
|
||||
public ItemLivingwoodBow() {
|
||||
@@ -45,11 +53,11 @@ public class ItemLivingwoodBow extends ItemBow implements IManaUsingItem {
|
||||
}
|
||||
|
||||
public ItemLivingwoodBow(String name) {
|
||||
super();
|
||||
setCreativeTab(BotaniaCreativeTab.INSTANCE);
|
||||
setUnlocalizedName(name);
|
||||
setMaxDamage(500);
|
||||
setFull3D();
|
||||
addPropertyOverride(new ResourceLocation("minecraft:pull"), (stack, worldIn, entityIn) -> (stack.getMaxItemUseDuration() - entityIn.getItemInUseCount()) * chargeVelocityMultiplier() / 20.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -64,30 +72,36 @@ public class ItemLivingwoodBow extends ItemBow implements IManaUsingItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) {
|
||||
ArrowNockEvent event = new ArrowNockEvent(p_77659_3_, p_77659_1_);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
if(event.isCanceled())
|
||||
return event.result;
|
||||
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) {
|
||||
// Copy from superclass with our own check
|
||||
boolean flag = canFire(stack, player);
|
||||
ActionResult<ItemStack> ret = ForgeEventFactory.onArrowNock(stack, world, player, hand, flag);
|
||||
if (ret != null) return ret;
|
||||
|
||||
if(canFire(p_77659_1_, p_77659_2_, p_77659_3_, 0))
|
||||
p_77659_3_.setItemInUse(p_77659_1_, getMaxItemUseDuration(p_77659_1_));
|
||||
|
||||
return p_77659_1_;
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
return !flag ? new ActionResult<>(EnumActionResult.FAIL, stack) : new ActionResult<>(EnumActionResult.PASS, stack);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.setActiveHand(hand);
|
||||
return new ActionResult<>(EnumActionResult.SUCCESS, stack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerStoppedUsing(ItemStack p_77615_1_, World p_77615_2_, EntityPlayer p_77615_3_, int p_77615_4_) {
|
||||
int j = (int) ((getMaxItemUseDuration(p_77615_1_) - p_77615_4_) * chargeVelocityMultiplier());
|
||||
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityLivingBase shooter, int useTicks) {
|
||||
int j = (int) ((getMaxItemUseDuration(stack) - useTicks) * chargeVelocityMultiplier());
|
||||
|
||||
ArrowLooseEvent event = new ArrowLooseEvent(p_77615_3_, p_77615_1_, j);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
if(event.isCanceled())
|
||||
return;
|
||||
j = event.charge;
|
||||
if(shooter instanceof EntityPlayer) {
|
||||
ArrowLooseEvent event = new ArrowLooseEvent(((EntityPlayer) shooter), stack, world, j, true);
|
||||
if(MinecraftForge.EVENT_BUS.post(event))
|
||||
return;
|
||||
j = event.getCharge();
|
||||
}
|
||||
|
||||
boolean flag = canFire(p_77615_1_, p_77615_2_, p_77615_3_, p_77615_4_);
|
||||
boolean infinity = EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, p_77615_1_) > 0;
|
||||
boolean flag = !(shooter instanceof EntityPlayer) || canFire(stack, ((EntityPlayer) shooter));
|
||||
boolean infinity = EnchantmentHelper.getEnchantmentLevel(Enchantments.infinity, stack) > 0;
|
||||
|
||||
if(flag) {
|
||||
float f = j / 20.0F;
|
||||
@@ -99,31 +113,32 @@ public class ItemLivingwoodBow extends ItemBow implements IManaUsingItem {
|
||||
if(f > 1.0F)
|
||||
f = 1.0F;
|
||||
|
||||
EntityArrow entityarrow = makeArrow(p_77615_1_, p_77615_2_, p_77615_3_, p_77615_4_, f);
|
||||
ItemStack ammo = shooter instanceof EntityPlayer ? PlayerHelper.getAmmo(((EntityPlayer) shooter), AMMO_FUNC) : new ItemStack(Items.arrow);
|
||||
EntityArrow entityarrow = ((ItemArrow) (ammo == null ? Items.arrow : ammo.getItem())).createArrow(world, ammo, shooter);
|
||||
|
||||
if(f == 1.0F)
|
||||
entityarrow.setIsCritical(true);
|
||||
|
||||
int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, p_77615_1_);
|
||||
int k = EnchantmentHelper.getEnchantmentLevel(Enchantments.power, stack);
|
||||
|
||||
if(k > 0)
|
||||
entityarrow.setDamage(entityarrow.getDamage() + k * 0.5D + 0.5D);
|
||||
|
||||
int l = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, p_77615_1_);
|
||||
int l = EnchantmentHelper.getEnchantmentLevel(Enchantments.punch, stack);
|
||||
|
||||
if(l > 0)
|
||||
entityarrow.setKnockbackStrength(l);
|
||||
|
||||
if(EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, p_77615_1_) > 0)
|
||||
if(EnchantmentHelper.getEnchantmentLevel(Enchantments.flame, stack) > 0)
|
||||
entityarrow.setFire(100);
|
||||
|
||||
ToolCommons.damageItem(p_77615_1_, 1, p_77615_3_, MANA_PER_DAMAGE);
|
||||
p_77615_2_.playSoundAtEntity(p_77615_3_, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
|
||||
ToolCommons.damageItem(stack, 1, shooter, MANA_PER_DAMAGE);
|
||||
world.playSound(null, shooter.posX, shooter.posY, shooter.posZ, SoundEvents.entity_arrow_shoot, SoundCategory.PLAYERS, 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
|
||||
|
||||
onFire(p_77615_1_, p_77615_2_, p_77615_3_, p_77615_4_, infinity, entityarrow);
|
||||
onFire(stack, shooter, infinity, entityarrow);
|
||||
|
||||
if(!p_77615_2_.isRemote)
|
||||
p_77615_2_.spawnEntityInWorld(entityarrow);
|
||||
if(!world.isRemote)
|
||||
world.spawnEntityInWorld(entityarrow);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,18 +150,15 @@ public class ItemLivingwoodBow extends ItemBow implements IManaUsingItem {
|
||||
return true;
|
||||
}
|
||||
|
||||
EntityArrow makeArrow(ItemStack p_77615_1_, World p_77615_2_, EntityPlayer p_77615_3_, int p_77615_4_, float f) {
|
||||
return new EntityArrow(p_77615_2_, p_77615_3_, f * 2.0F);
|
||||
boolean canFire(ItemStack stack, EntityPlayer player) {
|
||||
return player.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantments.infinity, stack) > 0 || PlayerHelper.hasAmmo(player, AMMO_FUNC);
|
||||
}
|
||||
|
||||
boolean canFire(ItemStack p_77615_1_, World p_77615_2_, EntityPlayer p_77615_3_, int p_77615_4_) {
|
||||
return p_77615_3_.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, p_77615_1_) > 0 || p_77615_3_.inventory.hasItem(Items.arrow);
|
||||
}
|
||||
|
||||
void onFire(ItemStack p_77615_1_, World p_77615_2_, EntityPlayer p_77615_3_, int p_77615_4_, boolean infinity, EntityArrow arrow) {
|
||||
void onFire(ItemStack bow, EntityLivingBase living, boolean infinity, EntityArrow arrow) {
|
||||
if(infinity)
|
||||
arrow.canBePickedUp = 2;
|
||||
else p_77615_3_.inventory.consumeInventoryItem(Items.arrow);
|
||||
arrow.canBePickedUp = EntityArrow.PickupStatus.CREATIVE_ONLY;
|
||||
else if(living instanceof EntityPlayer)
|
||||
PlayerHelper.consumeAmmo(((EntityPlayer) living), AMMO_FUNC);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -165,25 +177,4 @@ public class ItemLivingwoodBow extends ItemBow implements IManaUsingItem {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
||||
String name = GameData.getItemRegistry().getNameForObject(this).toString();
|
||||
|
||||
if (useRemaining == 0) {
|
||||
return new ModelResourceLocation(name, "inventory");
|
||||
}
|
||||
|
||||
int j = (int) ((getMaxItemUseDuration(stack) - useRemaining) * chargeVelocityMultiplier());
|
||||
|
||||
if(j >= 18)
|
||||
return new ModelResourceLocation(name + "_pulling_3", "inventory");
|
||||
if(j > 13)
|
||||
return new ModelResourceLocation(name + "_pulling_2", "inventory");
|
||||
if(j > 0)
|
||||
return new ModelResourceLocation(name + "_pulling_1", "inventory");
|
||||
|
||||
return new ModelResourceLocation(name, "inventory");
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -22,7 +22,7 @@ public class ItemElementiumPick extends ItemManasteelPick {
|
||||
@SubscribeEvent
|
||||
public void onHarvestDrops(HarvestDropsEvent event) {
|
||||
if(event.harvester != null) {
|
||||
ItemStack stack = event.harvester.getCurrentEquippedItem();
|
||||
ItemStack stack = event.harvester.getHeldItemMainhand();
|
||||
if(stack != null && (stack.getItem() == this || stack.getItem() == ModItems.terraPick && ItemTerraPick.isTipped(stack))) {
|
||||
for(int i = 0; i < event.drops.size(); i++) {
|
||||
ItemStack drop = event.drops.get(i);
|
||||
|
||||
+4
-3
@@ -5,6 +5,7 @@ import net.minecraft.block.BlockFalling;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Enchantments;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
@@ -25,7 +26,7 @@ public class ItemElementiumShovel extends ItemManasteelShovel {
|
||||
@Override
|
||||
public boolean onBlockStartBreak(ItemStack stack, BlockPos pos, EntityPlayer player) {
|
||||
World world = player.worldObj;
|
||||
Material mat = world.getBlockState(pos).getBlock().getMaterial();
|
||||
Material mat = world.getBlockState(pos).getMaterial();
|
||||
if (!ToolCommons.isRightMaterial(mat, materialsShovel))
|
||||
return false;
|
||||
|
||||
@@ -33,8 +34,8 @@ public class ItemElementiumShovel extends ItemManasteelShovel {
|
||||
if (block == null)
|
||||
return false;
|
||||
|
||||
int fortune = EnchantmentHelper.getFortuneModifier(player);
|
||||
boolean silk = EnchantmentHelper.getSilkTouchModifier(player);
|
||||
int fortune = EnchantmentHelper.getEnchantmentLevel(Enchantments.fortune, player.getHeldItemMainhand());
|
||||
boolean silk = EnchantmentHelper.getEnchantmentLevel(Enchantments.silkTouch, player.getHeldItemMainhand()) > 0;
|
||||
|
||||
Block blk = world.getBlockState(pos).getBlock();
|
||||
if(blk instanceof BlockFalling)
|
||||
|
||||
+3
-2
@@ -18,6 +18,7 @@ import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Enchantments;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -156,8 +157,8 @@ public class ItemTerraPick extends ItemManasteelPick implements IManaItem, ISequ
|
||||
if(world.isAirBlock(pos))
|
||||
return;
|
||||
|
||||
int fortune = EnchantmentHelper.getFortuneModifier(player);
|
||||
boolean silk = EnchantmentHelper.getSilkTouchModifier(player);
|
||||
int fortune = EnchantmentHelper.getEnchantmentLevel(Enchantments.fortune, player.getHeldItemMainhand());
|
||||
boolean silk = EnchantmentHelper.getEnchantmentLevel(Enchantments.silkTouch, player.getHeldItemMainhand()) > 0;
|
||||
boolean thor = ItemThorRing.getThorRing(player) != null;
|
||||
boolean doX = thor || side.getFrontOffsetX() == 0;
|
||||
boolean doY = thor || side.getFrontOffsetY() == 0;
|
||||
|
||||
+2
-1
@@ -11,6 +11,7 @@
|
||||
package vazkii.botania.common.item.interaction.thaumcraft;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import thaumcraft.api.items.IGoggles;
|
||||
import thaumcraft.api.items.IRevealer;
|
||||
@@ -40,7 +41,7 @@ public class ItemElementiumHelmRevealing extends ItemElementiumHelm implements I
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArmorTextureAfterInk(ItemStack stack, int slot) {
|
||||
public String getArmorTextureAfterInk(ItemStack stack, EntityEquipmentSlot slot) {
|
||||
return ConfigHandler.enableArmorModels ? LibResources.MODEL_ELEMENTIUM_NEW : LibResources.MODEL_ELEMENTIUM_2;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -11,6 +11,7 @@
|
||||
package vazkii.botania.common.item.interaction.thaumcraft;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.RecipeSorter;
|
||||
import net.minecraftforge.oredict.RecipeSorter.Category;
|
||||
@@ -46,7 +47,7 @@ public class ItemManasteelHelmRevealing extends ItemManasteelHelm implements IGo
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArmorTextureAfterInk(ItemStack stack, int slot) {
|
||||
public String getArmorTextureAfterInk(ItemStack stack, EntityEquipmentSlot slot) {
|
||||
return ConfigHandler.enableArmorModels ? LibResources.MODEL_MANASTEEL_NEW : LibResources.MODEL_MANASTEEL_2;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -11,6 +11,7 @@
|
||||
package vazkii.botania.common.item.interaction.thaumcraft;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import thaumcraft.api.items.IGoggles;
|
||||
import thaumcraft.api.items.IRevealer;
|
||||
@@ -40,7 +41,7 @@ public class ItemTerrasteelHelmRevealing extends ItemTerrasteelHelm implements I
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArmorTextureAfterInk(ItemStack stack, int slot) {
|
||||
public String getArmorTextureAfterInk(ItemStack stack, EntityEquipmentSlot slot) {
|
||||
return ConfigHandler.enableArmorModels ? LibResources.MODEL_TERRASTEEL_NEW : LibResources.MODEL_TERRASTEEL_2;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ public class ItemManaResource extends ItemMod implements IFlowerComponent, IElve
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
boolean rightEvent = event.action == Action.RIGHT_CLICK_AIR;
|
||||
/*boolean rightEvent = event.action == Action.RIGHT_CLICK_AIR; todo 1.9
|
||||
ItemStack stack = event.entityPlayer.getCurrentEquippedItem();
|
||||
boolean correctStack = stack != null && stack.getItem() == Items.glass_bottle;
|
||||
boolean ender = event.world.provider.getDimension() == 1;
|
||||
@@ -89,7 +89,7 @@ public class ItemManaResource extends ItemMod implements IFlowerComponent, IElve
|
||||
event.world.playSound(null, event.pos, SoundEvents.entity_item_pickup, SoundCategory.PLAYERS, 0.5F, 1F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,13 +12,18 @@ package vazkii.botania.common.item.relic;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.mana.IManaUsingItem;
|
||||
import vazkii.botania.api.mana.ManaItemHandler;
|
||||
import vazkii.botania.api.sound.BotaniaSoundEvents;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
import vazkii.botania.common.entity.EntityBabylonWeapon;
|
||||
@@ -36,14 +41,14 @@ public class ItemKingKey extends ItemRelic implements IManaUsingItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
par3EntityPlayer.setItemInUse(par1ItemStack, getMaxItemUseDuration(par1ItemStack));
|
||||
public ActionResult<ItemStack> onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, EnumHand hand) {
|
||||
par3EntityPlayer.setActiveHand(hand);
|
||||
setCharging(par1ItemStack, true);
|
||||
return par1ItemStack;
|
||||
return ActionResult.newResult(EnumActionResult.SUCCESS, par1ItemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int time) {
|
||||
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityLivingBase living, int time) {
|
||||
int spawned = getWeaponsSpawned(stack);
|
||||
if(spawned == 20) {
|
||||
setCharging(stack, false);
|
||||
@@ -52,19 +57,19 @@ public class ItemKingKey extends ItemRelic implements IManaUsingItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUsingTick(ItemStack stack, EntityPlayer player, int count) {
|
||||
public void onUsingTick(ItemStack stack, EntityLivingBase living, int count) {
|
||||
int spawned = getWeaponsSpawned(stack);
|
||||
|
||||
if(count != getMaxItemUseDuration(stack) && spawned < 20 && !player.worldObj.isRemote && ManaItemHandler.requestManaExact(stack, player, 150, true)) {
|
||||
Vector3 look = new Vector3(player.getLookVec());
|
||||
if(count != getMaxItemUseDuration(stack) && spawned < 20 && !living.worldObj.isRemote && (!(living instanceof EntityPlayer) || ManaItemHandler.requestManaExact(stack, ((EntityPlayer) living), 150, true))) {
|
||||
Vector3 look = new Vector3(living.getLookVec());
|
||||
look.y = 0;
|
||||
look.normalize().negate().multiply(2);
|
||||
int div = spawned / 5;
|
||||
int mod = spawned % 5;
|
||||
|
||||
Vector3 pl = look.copy().add(Vector3.fromEntityCenter(player)).add(0, 1.6, div * 0.1);
|
||||
Vector3 pl = look.copy().add(Vector3.fromEntityCenter(living)).add(0, 1.6, div * 0.1);
|
||||
|
||||
Random rand = player.worldObj.rand;
|
||||
Random rand = living.worldObj.rand;
|
||||
Vector3 axis = look.copy().normalize().crossProduct(new Vector3(-1, 0, -1)).normalize();
|
||||
Vector3 axis1 = axis.copy();
|
||||
|
||||
@@ -76,17 +81,17 @@ public class ItemKingKey extends ItemRelic implements IManaUsingItem {
|
||||
|
||||
Vector3 end = pl.copy().add(axis1);
|
||||
|
||||
EntityBabylonWeapon weapon = new EntityBabylonWeapon(player.worldObj, player);
|
||||
EntityBabylonWeapon weapon = new EntityBabylonWeapon(living.worldObj, living);
|
||||
weapon.posX = end.x;
|
||||
weapon.posY = end.y;
|
||||
weapon.posZ = end.z;
|
||||
weapon.rotationYaw = player.rotationYaw;
|
||||
weapon.rotationYaw = living.rotationYaw;
|
||||
weapon.setVariety(rand.nextInt(WEAPON_TYPES));
|
||||
weapon.setDelay(spawned);
|
||||
weapon.setRotation(MathHelper.wrapAngleTo180_float(-player.rotationYaw + 180));
|
||||
weapon.setRotation(MathHelper.wrapAngleTo180_float(-living.rotationYaw + 180));
|
||||
|
||||
player.worldObj.spawnEntityInWorld(weapon);
|
||||
player.worldObj.playSoundAtEntity(weapon, "botania:babylonSpawn", 1F, 1F + player.worldObj.rand.nextFloat() * 3F);
|
||||
living.worldObj.spawnEntityInWorld(weapon);
|
||||
weapon.playSound(BotaniaSoundEvents.babylonSpawn, 1F, 1F + living.worldObj.rand.nextFloat() * 3F);
|
||||
setWeaponsSpawned(stack, spawned + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,12 +15,14 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Enchantments;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -67,7 +69,7 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
EntityPlayer player = event.entityPlayer;
|
||||
/*EntityPlayer player = event.entityPlayer; todo 1.9
|
||||
ItemStack lokiRing = getLokiRing(player);
|
||||
if(lokiRing == null || player.worldObj.isRemote)
|
||||
return;
|
||||
@@ -132,7 +134,7 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
public static void breakOnAllCursors(EntityPlayer player, Item item, ItemStack stack, BlockPos pos, EnumFacing side) {
|
||||
@@ -143,15 +145,15 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
|
||||
List<BlockPos> cursors = getCursorList(lokiRing);
|
||||
ISequentialBreaker breaker = (ISequentialBreaker) item;
|
||||
World world = player.worldObj;
|
||||
boolean silk = EnchantmentHelper.getEnchantmentLevel(Enchantment.silkTouch.effectId, stack) > 0;
|
||||
int fortune = EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack);
|
||||
boolean silk = EnchantmentHelper.getEnchantmentLevel(Enchantments.silkTouch, stack) > 0;
|
||||
int fortune = EnchantmentHelper.getEnchantmentLevel(Enchantments.fortune, stack);
|
||||
boolean dispose = breaker.disposeOfTrashBlocks(stack);
|
||||
|
||||
for(int i = 0; i < cursors.size(); i++) {
|
||||
BlockPos coords = cursors.get(i);
|
||||
Block block = world.getBlockState(coords).getBlock();
|
||||
IBlockState state = world.getBlockState(coords);
|
||||
breaker.breakOtherBlock(player, stack, coords, coords, side);
|
||||
ToolCommons.removeBlockWithDrops(player, stack, player.worldObj, coords, pos, block, new Material[] { block.getMaterial() }, silk, fortune, block.getBlockHardness(world, coords), dispose);
|
||||
ToolCommons.removeBlockWithDrops(player, stack, player.worldObj, coords, pos, state.getBlock(), new Material[] { state.getMaterial() }, silk, fortune, state.getBlockHardness(world, coords), dispose);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ public class ItemTerraformRod extends ItemMod implements IManaUsingItem, IBlockP
|
||||
boolean hasAir = false;
|
||||
List<BlockPos> airBlocks = new ArrayList<>();
|
||||
|
||||
for(EnumFacing dir : LibMisc.CARDINAL_DIRECTIONS) {
|
||||
for(EnumFacing dir : EnumFacing.HORIZONTALS) {
|
||||
BlockPos pos_ = pos.offset(dir);
|
||||
Block block_ = par2World.getBlockState(pos_).getBlock();
|
||||
if(block_.isAir(par2World.getBlockState(pos_), par2World, pos_) || block_.isReplaceable(par2World, pos_) || block_ instanceof BlockFlower && !(block_ instanceof ISpecialFlower) || block_ == Blocks.double_plant) {
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
*/
|
||||
package vazkii.botania.common.lib;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
public final class LibMisc {
|
||||
|
||||
// Mod Constants
|
||||
@@ -20,7 +18,7 @@ public final class LibMisc {
|
||||
public static final String BUILD = "GRADLE:BUILD";
|
||||
public static final String VERSION = "GRADLE:VERSION-" + BUILD;
|
||||
public static final String DEPENDENCIES = "required-after:Baubles;after:Thaumcraft";
|
||||
public static final String MC_VERSIONS = "[1.8.8,1.8.9]";
|
||||
public static final String MC_VERSIONS = "[1.9]";
|
||||
|
||||
// Network Contants
|
||||
public static final String NETWORK_CHANNEL = MOD_ID;
|
||||
@@ -33,8 +31,6 @@ public final class LibMisc {
|
||||
// IMC Keys
|
||||
public static final String BLACKLIST_ITEM = "blackListItem";
|
||||
|
||||
public static final EnumFacing[] CARDINAL_DIRECTIONS = EnumFacing.HORIZONTALS;
|
||||
|
||||
public static final int[] CONTROL_CODE_COLORS = new int[] {
|
||||
0x000000, 0x0000AA, 0x00AA00, 0x00AAAA,
|
||||
0xAA0000, 0xAA00AA, 0xFFAA00, 0xAAAAAA,
|
||||
|
||||
@@ -110,4 +110,7 @@ public final class LibObfuscation {
|
||||
public static final String[] PREV_EQUIPPED_PROGRESS = { "prevEquippedProgress", "field_78451_d", "f" };
|
||||
public static final String[] EQUIPPED_PROGRESS = { "equippedProgress", "field_78454_c", "e" };
|
||||
|
||||
// RenderPlayer
|
||||
public static final String[] ADD_LAYER = { "addLayer", "", "" };
|
||||
|
||||
}
|
||||
@@ -66,7 +66,7 @@ public final class SkyblockWorldEvents {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
if(WorldTypeSkyblock.isWorldSkyblock(event.world)) {
|
||||
/*if(WorldTypeSkyblock.isWorldSkyblock(event.world)) { todo 1.9
|
||||
ItemStack equipped = event.entityPlayer.getCurrentEquippedItem();
|
||||
if(event.action == Action.RIGHT_CLICK_BLOCK && equipped == null && event.entityPlayer.isSneaking()) {
|
||||
Block block = event.world.getBlockState(event.pos).getBlock();
|
||||
@@ -93,7 +93,7 @@ public final class SkyblockWorldEvents {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
Reference in new issue
Block a user