Skip to content

Commit

Permalink
Merge pull request #272 from Fi0x/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Fi0x authored Feb 4, 2021
2 parents 5230960 + 286b703 commit c0f6e94
Show file tree
Hide file tree
Showing 220 changed files with 5,422 additions and 375 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
with:
java-version: 1.8
- name: Build with Gradle
run: ./gradlew build
run: ./gradlew build --warning-mode all
45 changes: 31 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ buildscript {
apply plugin: 'net.minecraftforge.gradle'
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
//apply plugin: 'maven-publish'

version = '1.0'
group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
Expand Down Expand Up @@ -56,6 +56,20 @@ minecraft {
}
}

repositories {
mavenCentral()
maven {
// location of the maven that hosts JEI files
name = "Progwml6 maven"
url = "https://dvs1.progwml6.com/files/maven/"
}
maven {
// location of a maven mirror for JEI files, as a fallback
name = "ModMaven"
url = "https://modmaven.k-4u.nl"
}
}

dependencies {
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
Expand All @@ -80,7 +94,10 @@ dependencies {
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html

testImplementation 'junit:junit:4.+'
// compile against the JEI API but do not include it at runtime
compileOnly "mezz.jei:jei_${mc_version}:${jei_version}:api"
// at runtime, use the full JEI jar
runtime "mezz.jei:jei_${mc_version}:${jei_version}"
}

// Example for how to get properties into the manifest for reading by the runtime..
Expand All @@ -104,15 +121,15 @@ jar.finalizedBy('reobfJar')
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing
//publish.dependsOn('reobfJar')

publishing {
publications {
mavenJava(MavenPublication) {
artifact jar
}
}
repositories {
maven {
url "file:///${project.projectDir}/mcmodsrepo"
}
}
}
//publishing {
// publications {
// mavenJava(MavenPublication) {
// artifact jar
// }
// }
// repositories {
// maven {
// url "file:///${project.projectDir}/mcmodsrepo"
// }
// }
//}
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
org.gradle.daemon=false
mc_version=1.12.2
jei_version=4.16.1.301
2 changes: 1 addition & 1 deletion src/main/java/com/fi0x/deepmagic/blocks/BlockBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import java.util.Objects;

public class BlockBase extends Block implements IHasModel
public abstract class BlockBase extends Block implements IHasModel
{
public BlockBase(String name, Material material)
{
Expand Down
51 changes: 3 additions & 48 deletions src/main/java/com/fi0x/deepmagic/blocks/DemonStone.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,18 @@
import com.fi0x.deepmagic.items.DemonCrystal;
import com.fi0x.deepmagic.mana.player.PlayerMana;
import com.fi0x.deepmagic.mana.player.PlayerProperties;
import com.fi0x.deepmagic.particlesystem.ParticleEnum;
import com.fi0x.deepmagic.particlesystem.ParticleSpawner;
import com.fi0x.deepmagic.util.handlers.ConfigHandler;
import com.fi0x.deepmagic.world.StructureChecker;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

import javax.annotation.Nonnull;
import java.util.Random;

public class DemonStone extends BlockBase
{
Expand All @@ -41,8 +38,8 @@ public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @
{
PlayerMana playerMana = playerIn.getCapability(PlayerProperties.PLAYER_MANA, null);
assert playerMana != null;
if(!validateStructure(worldIn, pos)) return false;
if(playerMana.removeMana(playerIn, ConfigHandler.demonSummonCost))
if(!StructureChecker.verifyDemonStructure(worldIn, pos)) return false;
if(playerMana.removeMana(playerIn, ConfigHandler.demonSummonCost, true))
{
playerIn.getHeldItem(hand).shrink(1);
playerMana.addSkillXP(playerIn, ConfigHandler.demonSummonXP);
Expand All @@ -55,46 +52,4 @@ public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @
}
return true;
}
@Override
public void randomDisplayTick(@Nonnull IBlockState stateIn, @Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull Random rand)
{
if(rand.nextInt(100) + 1 > ConfigHandler.demonStoneParticles) return;
if(!validateStructure(worldIn, pos)) return;

int particles = 0;
switch(Minecraft.getMinecraft().gameSettings.particleSetting)
{
case 0:
particles = 1;
break;
case 1:
particles = 2;
}

for(int i = 0; i < particles; i++)
{
double xCenter = pos.getX() + 0.5;
double y = pos.getY() + 1;
double zCenter = pos.getZ() + 0.5;

double xOff = Math.random() * 3 - 1.5;
double zOff = Math.random() * 3 - 1.5;

ParticleSpawner.spawnParticle(ParticleEnum.DEMON_STONE, xCenter + xOff, y, zCenter + zOff);
}
}
private boolean validateStructure(World world, BlockPos pos)
{
pos = pos.down();
if(!ConfigHandler.requireDemonStructure) return true;
return world.getBlockState(pos).getBlock().getUnlocalizedName().equals("tile.demon_crystal_block") &&
world.getBlockState(pos.north()).getBlock().getUnlocalizedName().equals("tile.deep_crystal_block") &&
world.getBlockState(pos.north().east()).getBlock().getUnlocalizedName().equals("tile.blockIron") &&
world.getBlockState(pos.north().west()).getBlock().getUnlocalizedName().equals("tile.blockIron") &&
world.getBlockState(pos.south()).getBlock().getUnlocalizedName().equals("tile.deep_crystal_block") &&
world.getBlockState(pos.south().east()).getBlock().getUnlocalizedName().equals("tile.blockIron") &&
world.getBlockState(pos.south().west()).getBlock().getUnlocalizedName().equals("tile.blockIron") &&
world.getBlockState(pos.west()).getBlock().getUnlocalizedName().equals("tile.deep_crystal_block") &&
world.getBlockState(pos.east()).getBlock().getUnlocalizedName().equals("tile.deep_crystal_block");
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.fi0x.deepmagic.blocks.containers;

import com.fi0x.deepmagic.blocks.tileentity.TileEntityManaAltar;
import com.fi0x.deepmagic.blocks.mana.tile.TileEntityManaAltar;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.fi0x.deepmagic.blocks.containers;

import com.fi0x.deepmagic.blocks.tileentity.TileEntityManaFurnace;
import com.fi0x.deepmagic.blocks.mana.tile.TileEntityManaFurnace;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.fi0x.deepmagic.blocks.containers;

import com.fi0x.deepmagic.blocks.tileentity.TileEntityManaGeneratorInsanity;
import com.fi0x.deepmagic.blocks.mana.tile.TileEntityManaGeneratorInsanity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.fi0x.deepmagic.blocks.containers;

import com.fi0x.deepmagic.blocks.tileentity.TileEntityManaGeneratorMob;
import com.fi0x.deepmagic.blocks.mana.tile.TileEntityManaGeneratorMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.fi0x.deepmagic.blocks.containers;

import com.fi0x.deepmagic.blocks.tileentity.TileEntityManaGeneratorNormal;
import com.fi0x.deepmagic.blocks.mana.tile.TileEntityManaGeneratorNormal;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.fi0x.deepmagic.blocks.containers;

import com.fi0x.deepmagic.blocks.tileentity.TileEntityManaGrinder;
import com.fi0x.deepmagic.blocks.mana.tile.TileEntityManaGrinder;
import com.fi0x.deepmagic.util.recipes.ManaGrinderRecipes;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.fi0x.deepmagic.blocks.containers;

import com.fi0x.deepmagic.blocks.tileentity.TileEntityManaInfuser;
import com.fi0x.deepmagic.blocks.mana.tile.TileEntityManaInfuser;
import com.fi0x.deepmagic.util.recipes.ManaInfuserRecipes;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.fi0x.deepmagic.blocks.containers;

import com.fi0x.deepmagic.blocks.tileentity.TileEntityManaFurnace;
import com.fi0x.deepmagic.blocks.mana.tile.TileEntityManaFurnace;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.fi0x.deepmagic.blocks.containers;

import com.fi0x.deepmagic.blocks.tileentity.TileEntityManaGeneratorInsanity;
import com.fi0x.deepmagic.blocks.mana.tile.TileEntityManaGeneratorInsanity;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.fi0x.deepmagic.blocks.containers;

import com.fi0x.deepmagic.blocks.tileentity.TileEntityManaGeneratorNormal;
import com.fi0x.deepmagic.blocks.mana.tile.TileEntityManaGeneratorNormal;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.fi0x.deepmagic.blocks.containers;

import com.fi0x.deepmagic.blocks.tileentity.TileEntityManaGrinder;
import com.fi0x.deepmagic.blocks.mana.tile.TileEntityManaGrinder;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.fi0x.deepmagic.blocks.containers;

import com.fi0x.deepmagic.blocks.tileentity.TileEntityManaInfuser;
import com.fi0x.deepmagic.blocks.mana.tile.TileEntityManaInfuser;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ public Item getItemDropped(@Nonnull IBlockState state, @Nonnull Random rand, int
return Item.getItemFromBlock(ModBlocks.DEPTH_SAPLING);
}
@Override
protected int getSaplingDropChance(@Nonnull IBlockState state)
{
return 10;
}
@Override
public boolean isOpaqueCube(@Nonnull IBlockState state)
{
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.fi0x.deepmagic.Main;
import com.fi0x.deepmagic.blocks.BlockBase;
import com.fi0x.deepmagic.blocks.tileentity.TileEntityManaAltar;
import com.fi0x.deepmagic.blocks.mana.tile.TileEntityManaAltar;
import com.fi0x.deepmagic.init.ModBlocks;
import com.fi0x.deepmagic.items.mana.ManaLinker;
import com.fi0x.deepmagic.particlesystem.ParticleEnum;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.fi0x.deepmagic.Main;
import com.fi0x.deepmagic.blocks.BlockBase;
import com.fi0x.deepmagic.blocks.tileentity.TileEntityManaFurnace;
import com.fi0x.deepmagic.blocks.mana.tile.TileEntityManaFurnace;
import com.fi0x.deepmagic.init.ModBlocks;
import com.fi0x.deepmagic.items.mana.ManaLinker;
import com.fi0x.deepmagic.util.handlers.ConfigHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.fi0x.deepmagic.Main;
import com.fi0x.deepmagic.blocks.BlockBase;
import com.fi0x.deepmagic.blocks.tileentity.TileEntityManaGeneratorInsanity;
import com.fi0x.deepmagic.blocks.mana.tile.TileEntityManaGeneratorInsanity;
import com.fi0x.deepmagic.init.ModBlocks;
import com.fi0x.deepmagic.items.mana.ManaLinker;
import com.fi0x.deepmagic.particlesystem.ParticleEnum;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.fi0x.deepmagic.Main;
import com.fi0x.deepmagic.blocks.BlockBase;
import com.fi0x.deepmagic.blocks.tileentity.TileEntityManaGeneratorMob;
import com.fi0x.deepmagic.blocks.mana.tile.TileEntityManaGeneratorMob;
import com.fi0x.deepmagic.init.ModBlocks;
import com.fi0x.deepmagic.items.mana.ManaLinker;
import com.fi0x.deepmagic.particlesystem.ParticleEnum;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.fi0x.deepmagic.Main;
import com.fi0x.deepmagic.blocks.BlockBase;
import com.fi0x.deepmagic.blocks.tileentity.TileEntityManaGeneratorNormal;
import com.fi0x.deepmagic.blocks.mana.tile.TileEntityManaGeneratorNormal;
import com.fi0x.deepmagic.init.ModBlocks;
import com.fi0x.deepmagic.items.mana.ManaLinker;
import com.fi0x.deepmagic.particlesystem.ParticleEnum;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.fi0x.deepmagic.Main;
import com.fi0x.deepmagic.blocks.BlockBase;
import com.fi0x.deepmagic.blocks.tileentity.TileEntityManaGrinder;
import com.fi0x.deepmagic.blocks.mana.tile.TileEntityManaGrinder;
import com.fi0x.deepmagic.init.ModBlocks;
import com.fi0x.deepmagic.items.mana.ManaLinker;
import com.fi0x.deepmagic.particlesystem.ParticleEnum;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.fi0x.deepmagic.Main;
import com.fi0x.deepmagic.blocks.BlockBase;
import com.fi0x.deepmagic.blocks.tileentity.TileEntityManaInfuser;
import com.fi0x.deepmagic.blocks.mana.tile.TileEntityManaInfuser;
import com.fi0x.deepmagic.init.ModBlocks;
import com.fi0x.deepmagic.items.mana.ManaLinker;
import com.fi0x.deepmagic.particlesystem.ParticleEnum;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.fi0x.deepmagic.blocks.mana;

import com.fi0x.deepmagic.blocks.BlockBase;
import com.fi0x.deepmagic.blocks.tileentity.TileEntityManaRelay;
import com.fi0x.deepmagic.blocks.mana.tile.TileEntityManaRelay;
import com.fi0x.deepmagic.init.ModBlocks;
import com.fi0x.deepmagic.items.mana.ManaLinker;
import com.fi0x.deepmagic.particlesystem.ParticleEnum;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.fi0x.deepmagic.blocks;
package com.fi0x.deepmagic.blocks.mana;

import com.fi0x.deepmagic.blocks.mana.tile.TileEntitySpellStone;
import com.fi0x.deepmagic.blocks.tileentity.BlockTileEntity;
import com.fi0x.deepmagic.blocks.tileentity.TileEntitySpellStone;
import com.fi0x.deepmagic.items.mana.ManaLinker;
import com.fi0x.deepmagic.items.spells.Spell;
import com.fi0x.deepmagic.particlesystem.ParticleEnum;
Expand Down Expand Up @@ -134,10 +134,14 @@ private boolean chargeSpell(EntityPlayer playerIn, ItemStack stack, TileEntitySp
tile.resetManaMultiplier();

int manaCosts = (int) (manaBase * manaMult);

compound.setInteger("manaCosts", manaCosts);

double tier = Math.min(Math.log(Math.pow(manaCosts, 2.4)), 0.01 * Math.pow(manaCosts, 0.7));
if(compound.hasKey("tier")) tier = compound.getInteger("tier");
tier += tile.getSpellTier();
compound.setInteger("tier", (int) tier);
tile.resetSpellTier();

compound.setDouble("skillXP", Math.pow(manaCosts, 0.3));
return true;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.fi0x.deepmagic.blocks.tileentity;
package com.fi0x.deepmagic.blocks.mana.tile;

import com.fi0x.deepmagic.util.IManaTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

class ManaHelper
public class ManaHelper
{
private static boolean isManaTargetValid(World world, BlockPos targetPos, TileEntity te)
{
Expand Down
Loading

0 comments on commit c0f6e94

Please sign in to comment.