diff --git a/gradle.properties b/gradle.properties index 7ba4cbc..f77c8f0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,5 +3,5 @@ org.gradle.jvmargs=-Xmx4G mc_version=1.10.2 forge_version=1.10.2-12.18.3.2511 -mod_version=1.0 +mod_version=1.1 mappings_version=snapshot_20161111 diff --git a/src/main/java/jackyy/avaritiatweaks/AvaritiaTweaks.java b/src/main/java/jackyy/avaritiatweaks/AvaritiaTweaks.java index acf9841..f4d8218 100644 --- a/src/main/java/jackyy/avaritiatweaks/AvaritiaTweaks.java +++ b/src/main/java/jackyy/avaritiatweaks/AvaritiaTweaks.java @@ -18,7 +18,7 @@ public class AvaritiaTweaks { public static final String MODID = "avaritiatweaks"; public static final String MODNAME = "Avaritia Tweaks"; - public static final String VERSION = "1.10.2-1.0"; + public static final String VERSION = "1.10.2-1.1"; public static final String MCVERSION = "[1.10,1.11)"; public static final String DEPENDS = "required-after:avaritia;required-after:CodeChickenLib;after:Botania;"; public static final String GUIFACTORY = "jackyy.avaritiatweaks.config.ConfigGuiFactory"; diff --git a/src/main/java/jackyy/avaritiatweaks/client/Keys.java b/src/main/java/jackyy/avaritiatweaks/client/Keys.java index ffca2dc..9b8025b 100644 --- a/src/main/java/jackyy/avaritiatweaks/client/Keys.java +++ b/src/main/java/jackyy/avaritiatweaks/client/Keys.java @@ -12,7 +12,7 @@ @SideOnly(Side.CLIENT) public class Keys { - public static final KeyBinding NOCLIP = new KeyBinding("key.infinity_armor.noclip", new IKeyConflictContext() { + public static final KeyBinding NOCLIP = new KeyBinding(ModConfig.infinityArmor.infinityArmorNoClip ? "key.infinity_armor.noclip" : "key.infinity_armor.noclip.disabled", new IKeyConflictContext() { @Override public boolean isActive() { return KeyConflictContext.IN_GAME.isActive(); @@ -24,9 +24,7 @@ public boolean conflicts(IKeyConflictContext other) { }, Keyboard.KEY_APOSTROPHE, "key.categories.avaritiatweaks"); public static void init() { - if (ModConfig.infinityArmor.infinityArmorNoClip) { - ClientRegistry.registerKeyBinding(NOCLIP); - } + ClientRegistry.registerKeyBinding(NOCLIP); } } diff --git a/src/main/java/jackyy/avaritiatweaks/compat/botania/BotaniaCompat.java b/src/main/java/jackyy/avaritiatweaks/compat/botania/BotaniaCompat.java index 957e758..f452ff1 100644 --- a/src/main/java/jackyy/avaritiatweaks/compat/botania/BotaniaCompat.java +++ b/src/main/java/jackyy/avaritiatweaks/compat/botania/BotaniaCompat.java @@ -2,8 +2,11 @@ import jackyy.avaritiatweaks.AvaritiaTweaks; import jackyy.avaritiatweaks.compat.botania.block.BlockGaia; +import jackyy.avaritiatweaks.compat.botania.block.BlockInfinitato; +import jackyy.avaritiatweaks.compat.botania.render.RenderTileInfinitato; import jackyy.avaritiatweaks.compat.botania.subtile.SubTileAsgardandelion; import jackyy.avaritiatweaks.compat.botania.subtile.SubTileSoarleander; +import jackyy.avaritiatweaks.compat.botania.tile.TileInfinitato; import jackyy.avaritiatweaks.config.ModConfig; import jackyy.avaritiatweaks.util.ModUtils; import morph.avaritia.init.ModItems; @@ -14,6 +17,7 @@ import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraftforge.client.model.ModelLoader; +import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -25,11 +29,10 @@ public class BotaniaCompat { public static BlockGaia gaiaBlock = new BlockGaia(); + public static BlockInfinitato infinitato = new BlockInfinitato(); public static ItemStack asgardandelion = ModUtils.getFlower("asgardandelion"); public static ItemStack soarleander = ModUtils.getFlower("soarleander"); - public static RecipeRuneAltar soarleanderRecipe; - public static void preInit() { GameRegistry.register(gaiaBlock); GameRegistry.register(new ItemBlock(gaiaBlock), gaiaBlock.getRegistryName()); @@ -53,22 +56,41 @@ public String getUnlocalizedLoreTextForStack(ItemStack stack) { }); BotaniaAPI.addSubTileToCreativeMenu("soarleander"); } + if (ModConfig.Compats.botania.infinitato) { + GameRegistry.register(infinitato); + GameRegistry.register(new ItemBlock(infinitato), infinitato.getRegistryName()); + GameRegistry.registerTileEntity(TileInfinitato.class, "Avaritia_Infinitato"); + } } public static void init() { if (ModConfig.Compats.botania.asgardandelion) { SubTileAsgardandelion.lexicon = new BotaniaLexiconEntry("asgardandelion", BotaniaAPI.categoryGenerationFlowers); - SubTileAsgardandelion.lexicon.addPage(BotaniaAPI.internalHandler.textPage("botania.lexicon.asgardandelion.0")); + SubTileAsgardandelion.lexicon.setLexiconPages( + BotaniaAPI.internalHandler.textPage("botania.lexicon.asgardandelion.0") + ); SubTileAsgardandelion.lexicon.setIcon(asgardandelion); } if (ModConfig.Compats.botania.soarleander) { SubTileSoarleander.lexicon = new BotaniaLexiconEntry("soarleander", BotaniaAPI.categoryGenerationFlowers); SubTileSoarleander.lexicon.setLexiconPages( BotaniaAPI.internalHandler.textPage("botania.lexicon.soarleander.0"), - BotaniaAPI.internalHandler.runeRecipePage("botania.lexicon.soarleander.1", soarleanderRecipe) + BotaniaAPI.internalHandler.runeRecipePage("botania.lexicon.soarleander.1", new RecipeRuneAltar( + soarleander, 8000, ModUtils.getFlower("gourmaryllis"), + new ItemStack(Items.CHICKEN), new ItemStack(Items.CHICKEN), + new ItemStack(Items.CHICKEN), new ItemStack(Items.CHICKEN), + new ItemStack(Items.CHICKEN), new ItemStack(Items.CHICKEN), + new ItemStack(Items.CHICKEN), new ItemStack(Items.CHICKEN) + )) ); SubTileSoarleander.lexicon.setIcon(soarleander); } + if (ModConfig.Compats.botania.infinitato) { + BlockInfinitato.lexiconEntry = new BotaniaLexiconEntry("infinitato", BotaniaAPI.categoryMisc); + BlockInfinitato.lexiconEntry.setLexiconPages( + BotaniaAPI.internalHandler.textPage("botania.lexicon.infinitato.0") + ).setIcon(new ItemStack(infinitato)); + } } @SideOnly(Side.CLIENT) @@ -80,6 +102,10 @@ public static void initModels() { if (ModConfig.Compats.botania.soarleander) { BotaniaAPIClient.registerSubtileModel(SubTileSoarleander.class, new ModelResourceLocation(AvaritiaTweaks.MODID + ":soarleander")); } + if (ModConfig.Compats.botania.infinitato) { + ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(infinitato), 0, new ModelResourceLocation(infinitato.getRegistryName(), "facing=south")); + ClientRegistry.bindTileEntitySpecialRenderer(TileInfinitato.class, new RenderTileInfinitato()); + } } public static void initRecipes() { @@ -92,7 +118,8 @@ public static void initRecipes() { GameRegistry.addShapelessRecipe(ModUtils.getStackFromName("botania:manaResource", 9, 14), new ItemStack(gaiaBlock)); } if (ModConfig.Compats.botania.asgardandelion) { - ExtremeCraftingManager.getInstance().addRecipe(asgardandelion, + ExtremeCraftingManager.getInstance().addRecipe( + asgardandelion, " III ", " IIIII ", " IIXII ", @@ -109,7 +136,7 @@ public static void initRecipes() { ); } if (ModConfig.Compats.botania.soarleander) { - soarleanderRecipe = BotaniaAPI.registerRuneAltarRecipe( + BotaniaAPI.registerRuneAltarRecipe( soarleander, 8000, ModUtils.getFlower("gourmaryllis"), new ItemStack(Items.CHICKEN), new ItemStack(Items.CHICKEN), new ItemStack(Items.CHICKEN), new ItemStack(Items.CHICKEN), @@ -117,6 +144,23 @@ public static void initRecipes() { new ItemStack(Items.CHICKEN), new ItemStack(Items.CHICKEN) ); } + if (ModConfig.Compats.botania.infinitato) { + ExtremeCraftingManager.getInstance().addRecipe( + new ItemStack(infinitato), + "IIIIIIIII", + "IIIIIIIII", + "IIISISIII", + "IIIIIIIII", + "IISIXISII", + "IIISSSIII", + "IIIIIIIII", + "IIIIIIIII", + "IIIIIIIII", + 'I', ModUtils.getStackFromName("botania:tinyPotato", 1, 0), + 'X', new ItemStack(ModItems.resource, 1, 5), + 'S', new ItemStack(Items.DIAMOND) + ); + } } } diff --git a/src/main/java/jackyy/avaritiatweaks/compat/botania/BotaniaLexiconEntry.java b/src/main/java/jackyy/avaritiatweaks/compat/botania/BotaniaLexiconEntry.java index 82c5e17..ecbb226 100644 --- a/src/main/java/jackyy/avaritiatweaks/compat/botania/BotaniaLexiconEntry.java +++ b/src/main/java/jackyy/avaritiatweaks/compat/botania/BotaniaLexiconEntry.java @@ -19,7 +19,7 @@ public String getSubtitle(){ @Override public String getUnlocalizedName() { - return "avaritia.lexicon." + super.getUnlocalizedName(); + return "botania.lexicon." + super.getUnlocalizedName(); } } diff --git a/src/main/java/jackyy/avaritiatweaks/compat/botania/block/BlockInfinitato.java b/src/main/java/jackyy/avaritiatweaks/compat/botania/block/BlockInfinitato.java new file mode 100644 index 0000000..8dc949a --- /dev/null +++ b/src/main/java/jackyy/avaritiatweaks/compat/botania/block/BlockInfinitato.java @@ -0,0 +1,185 @@ +package jackyy.avaritiatweaks.compat.botania.block; + +import jackyy.avaritiatweaks.AvaritiaTweaks; +import jackyy.avaritiatweaks.compat.botania.tile.TileInfinitato; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.BlockStateContainer; +import net.minecraft.block.state.IBlockState; +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.EnumBlockRenderType; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.EnumParticleTypes; +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; +import vazkii.botania.api.state.BotaniaStateProps; +import vazkii.botania.common.core.helper.InventoryHelper; + +import javax.annotation.Nonnull; +import java.util.ArrayList; +import java.util.List; + +public class BlockInfinitato extends BlockContainer implements ILexiconable { + + private static float f = 1F / 16F * 4F; + private static final AxisAlignedBB AABB = new AxisAlignedBB(f, 0, f, 1F - f, f*3, 1F - f); + public static LexiconEntry lexiconEntry; + + public BlockInfinitato() { + super(Material.CLOTH); + setRegistryName("infinitato"); + setUnlocalizedName(AvaritiaTweaks.MODID + ".infinitato"); + setHardness(0.25F); + setCreativeTab(AvaritiaTweaks.TAB); + } + + @Override @SuppressWarnings("deprecation") + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) { + return AABB; + } + + @Override + public BlockStateContainer createBlockState() { + return new BlockStateContainer(this, BotaniaStateProps.CARDINALS); + } + + @Override + public int getMetaFromState(IBlockState state) { + switch(state.getValue(BotaniaStateProps.CARDINALS)) { + case NORTH: + return 0; + case WEST: + return 3; + case EAST: + return 1; + case SOUTH: + default: + return 2; + } + } + + @Override @SuppressWarnings("deprecation") + public IBlockState getStateFromMeta(int meta) { + EnumFacing side; + switch(meta) { + case 0: + side = EnumFacing.NORTH; + break; + case 1: + side = EnumFacing.EAST; + break; + case 2: + default: + side = EnumFacing.SOUTH; + break; + case 3: + side = EnumFacing.WEST; + } + return this.getDefaultState().withProperty(BotaniaStateProps.CARDINALS, side); + } + + @Override + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing facing, float hitX, float hitY, float hitZ) { + TileEntity tile = world.getTileEntity(pos); + if (tile instanceof TileInfinitato) { + ((TileInfinitato) tile).interact(player, hand, stack, facing); + world.spawnParticle(EnumParticleTypes.HEART, (double)pos.getX() + AABB.minX + Math.random() * (AABB.maxX - AABB.minX), (double)pos.getY() + AABB.maxY, (double)pos.getZ() + AABB.minZ + Math.random() * (AABB.maxZ - AABB.minZ), 0.0D, 0.0D, 0.0D); + world.spawnParticle(EnumParticleTypes.HEART, (double)pos.getX() + AABB.minX + Math.random() * (AABB.maxX - AABB.minX), (double)pos.getY() + AABB.maxY, (double)pos.getZ() + AABB.minZ + Math.random() * (AABB.maxZ - AABB.minZ), 0.0D, 0.0D, 0.0D); + world.spawnParticle(EnumParticleTypes.HEART, (double)pos.getX() + AABB.minX + Math.random() * (AABB.maxX - AABB.minX), (double)pos.getY() + AABB.maxY, (double)pos.getZ() + AABB.minZ + Math.random() * (AABB.maxZ - AABB.minZ), 0.0D, 0.0D, 0.0D); + } + return true; + } + + @Override + public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack) { + world.setBlockState(pos, state.withProperty(BotaniaStateProps.CARDINALS, entity.getHorizontalFacing().getOpposite())); + if (stack.hasDisplayName()) { + TileEntity tile = world.getTileEntity(pos); + if (tile != null) { + ((TileInfinitato)tile).name = stack.getDisplayName(); + } + } + } + + @Override + public boolean removedByPlayer(@Nonnull IBlockState state, World world, @Nonnull BlockPos pos, @Nonnull EntityPlayer player, boolean willHarvest) { + if (willHarvest) { + onBlockHarvested(world, pos, state, player); + return true; + } else { + return super.removedByPlayer(state, world, pos, player, willHarvest); + } + } + + @Override + public void harvestBlock(@Nonnull World world, EntityPlayer player, @Nonnull BlockPos pos, @Nonnull IBlockState state, TileEntity te, ItemStack stack) { + super.harvestBlock(world, player, pos, state, te, stack); + world.setBlockToAir(pos); + } + + @Override + public void breakBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state) { + TileInfinitato inv = (TileInfinitato)world.getTileEntity(pos); + InventoryHelper.dropInventory(inv, world, state, pos); + super.breakBlock(world, pos, state); + } + + @Override + public List getDrops(IBlockAccess world, BlockPos pos, @Nonnull IBlockState state, int fortune) { + ArrayList list = new ArrayList<>(); + TileEntity tile = world.getTileEntity(pos); + if (tile != null) { + ItemStack stack = new ItemStack(this); + String name = ((TileInfinitato)tile).name; + if (!name.isEmpty()) { + stack.setStackDisplayName(name); + } + list.add(stack); + } + return list; + } + + @Override @SuppressWarnings("deprecation") + public boolean isOpaqueCube(IBlockState state) { + return false; + } + + @Override @SuppressWarnings("deprecation") + public boolean isFullCube(IBlockState state) { + return false; + } + + @Override @SuppressWarnings("deprecation") + public boolean isNormalCube(IBlockState state) { + return false; + } + + @Override + public EnumBlockRenderType getRenderType(IBlockState state) { + return EnumBlockRenderType.ENTITYBLOCK_ANIMATED; + } + + @Override + public boolean hasTileEntity(IBlockState state) { + return true; + } + + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileInfinitato(); + } + + @Override + public LexiconEntry getEntry(World world, BlockPos blockPos, EntityPlayer entityPlayer, ItemStack itemStack) { + return lexiconEntry; + } + +} diff --git a/src/main/java/jackyy/avaritiatweaks/compat/botania/render/ModelInfinitato.java b/src/main/java/jackyy/avaritiatweaks/compat/botania/render/ModelInfinitato.java new file mode 100644 index 0000000..004430a --- /dev/null +++ b/src/main/java/jackyy/avaritiatweaks/compat/botania/render/ModelInfinitato.java @@ -0,0 +1,23 @@ +package jackyy.avaritiatweaks.compat.botania.render; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; + +public class ModelInfinitato extends ModelBase { + + private ModelRenderer potato; + + public ModelInfinitato() { + textureWidth = 64; + textureHeight = 32; + potato = new ModelRenderer(this, 0, 0); + potato.addBox(0F, 0F, 0F, 8, 12, 8); + potato.setRotationPoint(-4F, 12F, -4F); + potato.setTextureSize(64, 32); + } + + public void render() { + potato.render(1F / 16F); + } + +} \ No newline at end of file diff --git a/src/main/java/jackyy/avaritiatweaks/compat/botania/render/RenderTileInfinitato.java b/src/main/java/jackyy/avaritiatweaks/compat/botania/render/RenderTileInfinitato.java new file mode 100644 index 0000000..6424618 --- /dev/null +++ b/src/main/java/jackyy/avaritiatweaks/compat/botania/render/RenderTileInfinitato.java @@ -0,0 +1,129 @@ +package jackyy.avaritiatweaks.compat.botania.render; + +import jackyy.avaritiatweaks.AvaritiaTweaks; +import jackyy.avaritiatweaks.compat.botania.tile.TileInfinitato; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.VertexBuffer; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.RayTraceResult; +import org.lwjgl.opengl.GL11; + +public class RenderTileInfinitato extends TileEntitySpecialRenderer { + + public static boolean drawHalo = true; + private static final ResourceLocation texture = new ResourceLocation(AvaritiaTweaks.MODID,"textures/blocks/infinitato.png"); + public static final ResourceLocation halo = new ResourceLocation("avaritia", "textures/items/halo128.png"); + private static final ModelInfinitato model = new ModelInfinitato(); + + @Override + public void renderTileEntityAt(TileInfinitato te, double x, double y, double z, float partialTicks, int destroyStage) { + Tessellator tessellator = Tessellator.getInstance(); + VertexBuffer buffer = tessellator.getBuffer(); + Minecraft mc = Minecraft.getMinecraft(); + RayTraceResult pos = mc.objectMouseOver; + GlStateManager.pushMatrix(); + GlStateManager.enableRescaleNormal(); + GlStateManager.color(1F, 1F, 1F, 1F); + GlStateManager.translate(x, y, z); + GlStateManager.translate(0.5F, 1.5F, 0.5F); + GlStateManager.scale(1F, -1F, -1F); + int meta = te.getBlockMetadata(); + if (drawHalo) { + mc.renderEngine.bindTexture(halo); + GlStateManager.pushMatrix(); + double xdiff = (te.getPos().getX() + 0.5) - pos.hitVec.xCoord; + double ydiff = (te.getPos().getY() + 0.4) - pos.hitVec.yCoord; + double zdiff = (te.getPos().getZ() + 0.5) - pos.hitVec.zCoord; + double len = Math.sqrt(xdiff*xdiff + ydiff*ydiff + zdiff*zdiff); + xdiff /= len; + ydiff /= len; + zdiff /= len; + GlStateManager.translate(-xdiff, ydiff, zdiff); + GlStateManager.scale(1F, -1F, -1F); + GlStateManager.translate(0F, -1.15F, 0F); + GlStateManager.rotate((float) -pos.hitVec.yCoord, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate((float) pos.hitVec.xCoord, 1.0F, 0.0F, 0.0F); + float f = 1.6F; + float f1 = 0.016666668F * f; + GlStateManager.scale(f1, f1, f1); + GlStateManager.disableLighting(); + GlStateManager.depthMask(false); + GlStateManager.enableBlend(); + GlStateManager.disableAlpha(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); + int i=60; + buffer.color(0.0F, 0.0F, 0.0F, 1.0F); + buffer.pos(-i, -i, 0.0D).tex(0,0).endVertex(); + buffer.pos(-i, i, 0.0D).tex(1,0).endVertex(); + buffer.pos(i, i, 0.0D).tex(1,1).endVertex(); + buffer.pos(i, -i, 0.0D).tex(0,1).endVertex(); + tessellator.draw(); + GlStateManager.depthMask(true); + GlStateManager.enableLighting(); + GlStateManager.disableBlend(); + GlStateManager.enableAlpha(); + GlStateManager.color(1F, 1F, 1F, 1F); + GlStateManager.popMatrix(); + } + float rotY = meta * 90F - 180F; + GlStateManager.rotate(rotY, 0F, 1F, 0F); + float jump = te.jumpTicks*0.5f; + if(jump > 0) + jump += partialTicks*0.5f; + float up = (float) -Math.abs(Math.sin(jump / 10 * Math.PI)) * 0.2F; + float rotZ = (float) Math.sin(jump / 10 * Math.PI) * 2; + GlStateManager.translate(0F, up, 0F); + GlStateManager.rotate(rotZ, 0F, 0F, 1F); + mc.renderEngine.bindTexture(texture); + model.render(); + GlStateManager.pushMatrix(); + mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); + float scale = 1F / 4F; + GlStateManager.translate(0F, 1F, 0F); + GlStateManager.scale(scale, scale, scale); + GlStateManager.popMatrix(); + GlStateManager.rotate(-rotZ, 0F, 0F, 1F); + GlStateManager.rotate(-rotY, 0F, 1F, 0F); + GlStateManager.color(1F, 1F, 1F); + GlStateManager.scale(1F, -1F, -1F); + if(!te.name.isEmpty() && pos != null && pos.hitVec.xCoord == pos.hitVec.xCoord && pos.hitVec.yCoord == pos.hitVec.yCoord && pos.hitVec.zCoord == pos.hitVec.zCoord) { + GlStateManager.pushMatrix(); + GlStateManager.translate(0F, -0.4F, 0F); + GlStateManager.rotate((float) -pos.hitVec.yCoord, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate((float) pos.hitVec.xCoord, 1.0F, 0.0F, 0.0F); + float f = 1.6F; + float f1 = 0.016666668F * f; + GlStateManager.scale(-f1, -f1, f1); + GlStateManager.disableLighting(); + GlStateManager.translate(0.0F, 0F / f1, 0.0F); + GlStateManager.depthMask(false); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.enableTexture2D(); + buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); + int i = mc.fontRendererObj.getStringWidth(te.name) / 2; + buffer.color(0.0F, 0.0F, 0.0F, 0.25F); + buffer.pos(-i - 1, -1.0D, 0.0D).endVertex(); + buffer.pos(-i - 1, 8.0D, 0.0D).endVertex(); + buffer.pos(i + 1, 8.0D, 0.0D).endVertex(); + buffer.pos(i + 1, -1.0D, 0.0D).endVertex(); + tessellator.draw(); + GlStateManager.enableTexture2D(); + GlStateManager.depthMask(true); + mc.fontRendererObj.drawString(te.name, -mc.fontRendererObj.getStringWidth(te.name) / 2, 0, 0xFFFFFF); + GlStateManager.enableLighting(); + GlStateManager.enableBlend(); + GlStateManager.color(1F, 1F, 1F, 1F); + GlStateManager.scale(1F / -f1, 1F / -f1, 1F / f1); + GlStateManager.popMatrix(); + } + GlStateManager.popMatrix(); + } + +} diff --git a/src/main/java/jackyy/avaritiatweaks/compat/botania/tile/TileInfinitato.java b/src/main/java/jackyy/avaritiatweaks/compat/botania/tile/TileInfinitato.java new file mode 100644 index 0000000..9b4cd55 --- /dev/null +++ b/src/main/java/jackyy/avaritiatweaks/compat/botania/tile/TileInfinitato.java @@ -0,0 +1,94 @@ +package jackyy.avaritiatweaks.compat.botania.tile; + +import jackyy.avaritiatweaks.util.ModUtils; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.MobEffects; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.SoundCategory; +import net.minecraft.util.math.AxisAlignedBB; +import vazkii.botania.common.block.tile.TileTinyPotato; + +import java.util.List; + +public class TileInfinitato extends TileTinyPotato { + + private static final String TAG_NAME = "name"; + public int jumpTicks = 0; + public String name = ""; + private int nextDoIt = 0; + + public void interact(EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing side) { + jump(); + if(name.equalsIgnoreCase("shia labeouf") && !worldObj.isRemote && nextDoIt == 0) { + nextDoIt = 40; + worldObj.playSound(player, player.getPosition(), ModUtils.getSoundFromName("botania:doit"), + SoundCategory.BLOCKS, 2.5F, 0.7F); + } + double radius = 10.5; + int time = 3600; + List inspired = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, + new AxisAlignedBB(getPos().getX() - radius, getPos().getY() - radius, getPos().getZ() - radius, + getPos().getX() + radius, getPos().getY() + radius, getPos().getZ() + radius)); + for (EntityLivingBase ent : inspired) { + double dx = ent.posX - getPos().getX(); + double dy = ent.posY - getPos().getY(); + double dz = ent.posZ - getPos().getZ(); + double dist = Math.sqrt(dx*dx + dy*dy + dz*dz); + if (dist <= radius) { + ent.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, time, 1)); + ent.addPotionEffect(new PotionEffect(MobEffects.SPEED, time, 0)); + ent.addPotionEffect(new PotionEffect(MobEffects.JUMP_BOOST, time, 0)); + ent.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, time, 1)); + ent.addPotionEffect(new PotionEffect(MobEffects.HEALTH_BOOST, time, 0)); + ent.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, time, 1)); + ent.addPotionEffect(new PotionEffect(MobEffects.HASTE, time, 1)); + ent.addPotionEffect(new PotionEffect(MobEffects.FIRE_RESISTANCE, time, 0)); + ent.addPotionEffect(new PotionEffect(MobEffects.WATER_BREATHING, time, 0)); + ent.addPotionEffect(new PotionEffect(MobEffects.NIGHT_VISION, time, 0)); + ent.addPotionEffect(new PotionEffect(MobEffects.LUCK, time, 0)); + ent.addPotionEffect(new PotionEffect(MobEffects.ABSORPTION, time, 4)); + ent.addPotionEffect(new PotionEffect(MobEffects.SATURATION, time, 4)); + } + } + } + + @Override + public void jump() { + if (jumpTicks == 0) { + jumpTicks = 40; + } + } + + @Override + public void update() { + if(jumpTicks > 0) { + jumpTicks--; + if (jumpTicks == 20 || jumpTicks == 0) { + this.worldObj.createExplosion(null, getPos().getX() + 0.5, getPos().getY(), getPos().getZ() + 0.5, 0.0f, true); + } + } + if(nextDoIt > 0) + nextDoIt--; + } + + @Override + public void writePacketNBT(NBTTagCompound cmp) { + cmp.setString(TAG_NAME, name); + } + + @Override + public void readPacketNBT(NBTTagCompound cmp) { + name = cmp.getString(TAG_NAME); + } + + @Override + public int getSizeInventory() { + return 6; + } + +} diff --git a/src/main/java/jackyy/avaritiatweaks/config/ModConfig.java b/src/main/java/jackyy/avaritiatweaks/config/ModConfig.java index 8ca3808..2ae359b 100644 --- a/src/main/java/jackyy/avaritiatweaks/config/ModConfig.java +++ b/src/main/java/jackyy/avaritiatweaks/config/ModConfig.java @@ -55,6 +55,8 @@ public static class Botania { public boolean asgardandelion = true; @Config.Comment("If true, enables Soarleander") public boolean soarleander = true; + @Config.Comment("If true, enables Infinitato") + public boolean infinitato = true; } } diff --git a/src/main/java/jackyy/avaritiatweaks/tweaks/ModEventsHandler.java b/src/main/java/jackyy/avaritiatweaks/tweaks/ModEventsHandler.java index e44a224..57a4139 100644 --- a/src/main/java/jackyy/avaritiatweaks/tweaks/ModEventsHandler.java +++ b/src/main/java/jackyy/avaritiatweaks/tweaks/ModEventsHandler.java @@ -156,8 +156,10 @@ public void onTooltip(ItemTooltipEvent event) { @SubscribeEvent @SideOnly(Side.CLIENT) public void onKeyInput(InputEvent.KeyInputEvent event) { - if (Keys.NOCLIP.isPressed()) { - PacketHandler.INSTANCE.sendToServer(new PacketToggleNoClip()); + if (ModConfig.infinityArmor.infinityArmorNoClip) { + if (Keys.NOCLIP.isPressed()) { + PacketHandler.INSTANCE.sendToServer(new PacketToggleNoClip()); + } } } diff --git a/src/main/java/jackyy/avaritiatweaks/util/ModUtils.java b/src/main/java/jackyy/avaritiatweaks/util/ModUtils.java index 86146b0..b1e17ec 100644 --- a/src/main/java/jackyy/avaritiatweaks/util/ModUtils.java +++ b/src/main/java/jackyy/avaritiatweaks/util/ModUtils.java @@ -3,10 +3,12 @@ import jackyy.avaritiatweaks.tweaks.ModTweaks; import net.minecraft.enchantment.Enchantment; import net.minecraft.init.Enchantments; +import net.minecraft.init.SoundEvents; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.SoundEvent; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.relauncher.ReflectionHelper; @@ -25,6 +27,14 @@ public static ItemStack getStackFromName(String name, int amount, int meta) { return stack; } + public static SoundEvent getSoundFromName(String name) { + SoundEvent sound = SoundEvent.REGISTRY.getObject(new ResourceLocation(name)); + if (sound != null) { + return sound; + } + return SoundEvents.BLOCK_ANVIL_PLACE; + } + public static ItemStack getFlower(String type) { ItemStack flower = getStackFromName("botania:specialFlower", 1, 0); NBTTagCompound tag = new NBTTagCompound(); diff --git a/src/main/resources/assets/avaritiatweaks/blockstates/infinitato.json b/src/main/resources/assets/avaritiatweaks/blockstates/infinitato.json new file mode 100644 index 0000000..47bb01d --- /dev/null +++ b/src/main/resources/assets/avaritiatweaks/blockstates/infinitato.json @@ -0,0 +1,12 @@ +{ + "forge_marker": 1, + "defaults": { + "transform": "forge:default-block" + }, + "variants": { + "facing=north": { "model": "avaritiatweaks:infinitato" }, + "facing=south": { "model": "avaritiatweaks:infinitato", "y": 180 }, + "facing=west": { "model": "avaritiatweaks:infinitato", "y": 270 }, + "facing=east": { "model": "avaritiatweaks:infinitato", "y": 90 } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/avaritiatweaks/lang/en_US.lang b/src/main/resources/assets/avaritiatweaks/lang/en_US.lang index 2012b0a..04eb6dc 100644 --- a/src/main/resources/assets/avaritiatweaks/lang/en_US.lang +++ b/src/main/resources/assets/avaritiatweaks/lang/en_US.lang @@ -4,6 +4,7 @@ itemGroup.avaritiatweaks=Avaritia Tweaks #Key Bindings key.categories.avaritiatweaks=Avaritia Tweaks key.infinity_armor.noclip=Toggle No Clip Mode +key.infinity_armor.noclip.disabled=Toggle No Clip Mode (Disabled in config!) #Items item.avaritiatweaks.enhancement_crystal.name=Enhancement Crystal @@ -26,8 +27,13 @@ desc.avaritiatweaks.neutron_collector=The Neutron Collector collects a Pile of N desc.avaritiatweaks.enhancement_crystal=This crystal can be crafted with Infinity Armor / Tools to give them special capabilities, like Enchantments, Potion Effects, etc. #Botania Integration +tile.avaritiatweaks.infinitato.name=Infinitato tile.botania.flower.asgardandelion.lore=Watered with Vazkii's tears :c -botania.lexicon.asgardandelion.0=Rumors abound about some kind of godlike flower that can produce a never-ending torrent of mana. If such a mythical flower were to exist, it would probably require wealth and resources beyond mortal reckoning. &oStill not a SAO reference.&r tile.botania.flower.soarleander.lore=Just hook it up to my veeeeins! +botania.lexicon.asgardandelion=Asgardandelion +botania.lexicon.asgardandelion.0=Rumors abound about some kind of godlike flower that can produce a never-ending torrent of mana. If such a mythical flower were to exist, it would probably require wealth and resources beyond mortal reckoning. &oStill not a SAO reference.&r +botania.lexicon.soarleander=Soarleander botania.lexicon.soarleander.0=If you have a surfeit of chicken or chicken by-products, look no further! The Soarleander will devour any and all things chicken in the vicinity (chickens themselves included) while remaining totally disinterested in everything else. botania.lexicon.soarleander.1=&oAny random chests are an unintended side-effect.&r +botania.lexicon.infinitato=Infinitato +botania.lexicon.infinitato.0=Imprinting the essence of everything onto objects can have interesting results, and the Infinitato is no exception. Somewhat larger than its tiny sibling, and infused with the can-do attitude of a whole crowd of &1Tiny Potatoes&0 plus an &1Infinity Catalyst&0, the &1Infinitato&0 believes that you can do all the things, forever. diff --git a/src/main/resources/assets/avaritiatweaks/models/block/infinitato.json b/src/main/resources/assets/avaritiatweaks/models/block/infinitato.json new file mode 100644 index 0000000..a83c5f8 --- /dev/null +++ b/src/main/resources/assets/avaritiatweaks/models/block/infinitato.json @@ -0,0 +1,20 @@ +{ + "textures": { + "all": "avaritiatweaks:blocks/infinitato_inv", + "particle": "avaritiatweaks:blocks/infinitato_inv" + }, + "elements": [ + { + "from": [ 4.0, 0.0, 4.0 ], + "to": [ 12.0, 12.0, 12.0 ], + "faces": { + "west": { "texture": "#all", "uv": [ 0.0, 4.0, 4.0, 10.0 ] }, + "north": { "texture": "#all", "uv": [ 4.0, 4.0, 8.0, 10.0 ] }, + "east": { "texture": "#all", "uv": [ 8.0, 4.0, 12.0, 10.0 ] }, + "south": { "texture": "#all", "uv": [ 12.0, 4.0, 16.0, 10.0 ] }, + "up": { "texture": "#all", "uv": [ 4.0, 0.0, 8.0, 4.0 ] }, + "down": { "texture": "#all", "uv": [ 8.0, 0.0, 12.0, 4.0 ], "cullface": "down" } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/avaritiatweaks/textures/blocks/infinitato.png b/src/main/resources/assets/avaritiatweaks/textures/blocks/infinitato.png new file mode 100644 index 0000000..eb7d4b5 Binary files /dev/null and b/src/main/resources/assets/avaritiatweaks/textures/blocks/infinitato.png differ diff --git a/src/main/resources/assets/avaritiatweaks/textures/blocks/infinitato_inv.png b/src/main/resources/assets/avaritiatweaks/textures/blocks/infinitato_inv.png new file mode 100644 index 0000000..3e48373 Binary files /dev/null and b/src/main/resources/assets/avaritiatweaks/textures/blocks/infinitato_inv.png differ diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 8612118..d82063f 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -3,7 +3,7 @@ "modid": "avaritiatweaks", "name": "Avaritia Tweaks", "description": "Enhances Avaritia to another level!", - "version": "1.10.2-1.0", + "version": "1.10.2-1.1", "mcversion": "1.10.2", "url": "https://github.com/JackyyTV/AvaritiaTweaks", "updateUrl": "",