diff --git a/Change Log.txt b/Change Log.txt index 8c3377af..d51c2960 100644 --- a/Change Log.txt +++ b/Change Log.txt @@ -3,10 +3,12 @@ -mobs spawned by stabilized spawner are now allowed to despawn after 30 seconds. -increased the length and render distance of the particle generator beam. -shortened the teleport sound. --added Draconium Infused Obsidian --added Draconic Portal --removed old debug code from bow --fixed energy crystal name localisation in hud +-added Draconium Infused Obsidian. +-added Draconic Portal. +-removed old debug code from bow. +-fixed energy crystal name localisation in hud. +-crystal binder can now rotate blocks. +-fixed weapon aoe not using power. ######## 1.0.1-Bugfix-c ######## -fixed crash when arrow from DE bow hits RFTools force field. diff --git a/README.md b/README.md index 1e8cca76..7d04c611 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ You CAN -Write your own code that uses this code as a dependency. (addon mods) +-Fork this project for the purpose of creating a pull request. You CANNOT diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileReactorCore.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileReactorCore.java index 45e867c4..2389e909 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileReactorCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileReactorCore.java @@ -46,8 +46,6 @@ public class RenderTileReactorCore extends TileEntitySpecialRenderer { double b = ff * 2; double a = ff < 0.1 ? (ff * 10) + 0.5 : 1; - - ResourceHandler.bindResource("textures/models/reactorCore.png"); GL11.glScaled(2F, 2F, 2F); GL11.glRotatef(rotation, 0.5F, 1F, 0.5F); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/ModBlocks.java b/src/main/java/com/brandon3055/draconicevolution/common/ModBlocks.java index 0da28ae6..1e29ff4e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/ModBlocks.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/ModBlocks.java @@ -44,6 +44,7 @@ public class ModBlocks { public static BlockDE dislocatorReceptacle; public static BlockDE portal; public static BlockDE reactorCore; + public static BlockDE flowGate; public static Block safetyFlame; public static ItemStack resurrectionStone; @@ -79,6 +80,7 @@ public class ModBlocks { dislocatorReceptacle = new DislocatorReceptacle(); portal = new Portal(); reactorCore = new ReactorCore(); + flowGate = new FlowGate(); longRangeDislocator = new LongRangeDislocator(); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/ItemBlockFrowGate.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/ItemBlockFrowGate.java new file mode 100644 index 00000000..974bcf7a --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/ItemBlockFrowGate.java @@ -0,0 +1,25 @@ +package com.brandon3055.draconicevolution.common.blocks.itemblocks; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; + +/** + * Created by Brandon on 25/6/2015. + */ +public class ItemBlockFrowGate extends ItemBlock { + public ItemBlockFrowGate(Block block) { + super(block); + this.setHasSubtypes(true); + } + + @Override + public String getUnlocalizedName(ItemStack stack) { + return super.getUnlocalizedName(stack) + (stack.getItemDamage() / 6 == 0 ? "Flux" : "Fluid"); + } + + @Override + public int getMetadata(int p_77647_1_) { + return p_77647_1_; + } +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/FlowGate.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/FlowGate.java new file mode 100644 index 00000000..ea83f4bf --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/FlowGate.java @@ -0,0 +1,191 @@ +package com.brandon3055.draconicevolution.common.blocks.machine; + +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.blocks.BlockDE; +import com.brandon3055.draconicevolution.common.blocks.itemblocks.ItemBlockFrowGate; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.utills.LogHelper; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +import java.util.List; + +/** + * Created by Brandon on 25/6/2015. + */ +public class FlowGate extends BlockDE { + + IIcon icon_input; + IIcon icon_output; + IIcon[] icon_fluid = new IIcon[4]; + IIcon[] icon_flux = new IIcon[4]; + + public FlowGate(){ + this.setBlockName("flowGate"); + this.setCreativeTab(DraconicEvolution.tabBlocksItems); + + ModBlocks.register(this, ItemBlockFrowGate.class); + } + + @Override + public boolean hasTileEntity(int metadata) { + return true; + } + + @Override + public TileEntity createTileEntity(World world, int metadata) { + LogHelper.info(metadata); + return super.createTileEntity(world, metadata); + } + + @Override + public void getSubBlocks(Item item, CreativeTabs p_149666_2_, List list) { + list.add(new ItemStack(item)); + list.add(new ItemStack(item, 1, 6)); + } + + @SideOnly(Side.CLIENT) + @Override + public void registerBlockIcons(IIconRegister iconRegister) { + blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "machine_side"); + icon_input = iconRegister.registerIcon(References.RESOURCESPREFIX + "machine_io_i"); + icon_output = iconRegister.registerIcon(References.RESOURCESPREFIX + "machine_io_o"); + for (int i = 0; i < 4; i++){ + icon_fluid[i] = iconRegister.registerIcon(References.RESOURCESPREFIX + "gates/fluidGate" + i); + icon_flux[i] = iconRegister.registerIcon(References.RESOURCESPREFIX + "gates/fluxGate" + i); + } + } + + @SideOnly(Side.CLIENT) + @Override + public IIcon getIcon(int side, int meta) { + int f = meta % 6; + int type = meta / 6; + + if (side == f) return icon_output; + else if (ForgeDirection.getOrientation(side).getOpposite().ordinal() == f) return icon_input; + else { + int t = 0; + if (f == 0) t = 1; + else if (f == 1) t = 3; + else if (f == 2) { + t = (side == 0 ? 3 : (side == 1 ? 3 : (side == 4 ? 2 : 0))); + } + else if (f == 3) { + t = (side == 0 ? 1 : (side == 1 ? 1 : (side == 4 ? 0 : 2))); + } + else if (f == 4) { + t = (side == 0 ? 2 : (side == 1 ? 2 : (side == 2 ? 0 : 2))); + } + else if (f == 5) { + t = (side == 0 ? 0 : (side == 1 ? 0 : (side == 2 ? 2 : 0))); + } + return type == 0 ? icon_flux[t] : icon_fluid[t]; + } + } + + @Override + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) { + int d = determineOrientation(world, x, y, z, entity) + stack.getItemDamage(); + world.setBlockMetadataWithNotify(x, y, z, d, 2); + } + + public static int determineOrientation(World world, int x, int y, int z, EntityLivingBase entity) + { + if (MathHelper.abs((float)entity.posX - (float)x) < 2.0F && MathHelper.abs((float)entity.posZ - (float)z) < 2.0F) + { + double d0 = entity.posY + 1.82D - (double)entity.yOffset; + + if (d0 - (double)y > 2.0D) + { + return 0; + } + + if ((double)y - d0 > 0.0D) + { + return 1; + } + } + + int l = MathHelper.floor_double((double)(entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + return l == 0 ? 3 : (l == 1 ? 4 : (l == 2 ? 2 : (l == 3 ? 5 : 0))); + } + + @Override + public int damageDropped(int meta) { + return (meta / 6) * 6; + } + + @Override + public boolean rotateBlock(World worldObj, int x, int y, int z, ForgeDirection axis) { + int meta = worldObj.getBlockMetadata(x, y, z); + int type = meta / 6; + ForgeDirection facing = ForgeDirection.getOrientation(meta % 6); + + if (facing == axis || facing == axis.getOpposite()) return false; + else if (axis == ForgeDirection.UP || axis == ForgeDirection.DOWN){ + if (facing == ForgeDirection.NORTH){ + facing = ForgeDirection.EAST; + } + else if (facing == ForgeDirection.SOUTH){ + facing = ForgeDirection.WEST; + } + else if (facing == ForgeDirection.EAST){ + facing = ForgeDirection.SOUTH; + } + else if (facing == ForgeDirection.WEST){ + facing = ForgeDirection.NORTH; + } + } + else if (axis == ForgeDirection.NORTH || axis == ForgeDirection.SOUTH){ + if (facing == ForgeDirection.UP){ + facing = ForgeDirection.WEST; + } + else if (facing == ForgeDirection.DOWN){ + facing = ForgeDirection.EAST; + } + else if (facing == ForgeDirection.EAST){ + facing = ForgeDirection.UP; + } + else if (facing == ForgeDirection.WEST){ + facing = ForgeDirection.DOWN; + } + } + else if (axis == ForgeDirection.EAST || axis == ForgeDirection.WEST){ + if (facing == ForgeDirection.UP){ + facing = ForgeDirection.NORTH; + } + else if (facing == ForgeDirection.DOWN){ + facing = ForgeDirection.SOUTH; + } + else if (facing == ForgeDirection.SOUTH){ + facing = ForgeDirection.UP; + } + else if (facing == ForgeDirection.NORTH){ + facing = ForgeDirection.DOWN; + } + } + + + worldObj.setBlockMetadataWithNotify(x, y, z, facing.ordinal() + (type * 6), 2); + return false; + } + + @Override + public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) { + return new ItemStack(this, 1, (world.getBlockMetadata(x, y, z) / 6) * 6); + } +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/Wrench.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/Wrench.java index 7fa4ede3..3a7f177f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/Wrench.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/Wrench.java @@ -1,6 +1,7 @@ package com.brandon3055.draconicevolution.common.items.tools; import cofh.api.energy.IEnergyReceiver; +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.items.ItemDE; @@ -8,9 +9,9 @@ import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.tileentities.energynet.TileRemoteEnergyBase; import com.brandon3055.draconicevolution.common.tileentities.energynet.TileWirelessEnergyTransceiver; import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -18,6 +19,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.StatCollector; import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; import java.util.ArrayList; import java.util.List; @@ -36,6 +38,7 @@ public class Wrench extends ItemDE implements IHudDisplayItem { this.setUnlocalizedName(Strings.wrenchName); this.setCreativeTab(DraconicEvolution.tabToolsWeapons); this.setMaxStackSize(1); + ModItems.register(this); } @@ -106,6 +109,9 @@ public class Wrench extends ItemDE implements IHudDisplayItem { public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) { if (world.isRemote) return false; + Block clicked = world.getBlock(x, y, z); + if (clicked.rotateBlock(world, x, y, z, ForgeDirection.getOrientation(side))) return true; + TileEntity tileClicked = world.getTileEntity(x, y, z); if (tileClicked instanceof TileRemoteEnergyBase) return false; else if (!(tileClicked instanceof IEnergyReceiver)) return false; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/ToolHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/ToolHandler.java index 34bb4007..cf858c2f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/ToolHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/ToolHandler.java @@ -194,13 +194,16 @@ public class ToolHandler { AxisAlignedBB box = AxisAlignedBB.getBoundingBox(entity.posX - range, entity.posY - range, entity.posZ - range, entity.posX + range, entity.posY + range, entity.posZ + range).expand(1.0D, 1.0D, 1.0D); List list = world.getEntitiesWithinAABBExcludingEntity(player, box); if (range == 0) return; + IEnergyContainerItem item = (IEnergyContainerItem)stack.getItem(); for (Object entityObject : list) { + if (item.getEnergyStored(stack) < References.ENERGYPERATTACK) break; if (entityObject instanceof EntityLivingBase) { EntityLivingBase entityLivingBase = (EntityLivingBase) entityObject; if (entityLivingBase.getEntityId() == entity.getEntityId()) continue; entityLivingBase.attackEntityFrom(DamageSource.causePlayerDamage(player), getDamageAgainstEntity(stack, entityLivingBase)); + item.extractEnergy(stack, References.ENERGYPERATTACK, false); if (EnchantmentHelper.getEnchantmentLevel(Enchantment.fireAspect.effectId, stack) > 0) entityLivingBase.setFire(EnchantmentHelper.getEnchantmentLevel(Enchantment.fireAspect.effectId, stack) * 15); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDraconiumChest.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDraconiumChest.java index 041a1331..af3651e0 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDraconiumChest.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDraconiumChest.java @@ -2,13 +2,13 @@ package com.brandon3055.draconicevolution.common.tileentities; import cofh.api.energy.IEnergyContainerItem; import cofh.api.energy.IEnergyReceiver; +import com.brandon3055.brandonscore.common.utills.InventoryUtils; import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.blocks.DraconiumChest; import com.brandon3055.draconicevolution.common.container.ContainerDraconiumChest; import com.brandon3055.draconicevolution.common.lib.OreDoublingRegistry; import com.brandon3055.draconicevolution.common.utills.EnergyStorage; import com.brandon3055.draconicevolution.common.utills.ICustomItemData; -import com.brandon3055.brandonscore.common.utills.InventoryUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; @@ -61,7 +61,11 @@ public class TileDraconiumChest extends TileEntity implements ISidedInventory, I @Override public void updateEntity() { - super.updateEntity(); + + //int t = (tick/20) % 12; + //if (!worldObj.isRemote) LogHelper.info(t / 6 + " : " + t % 6 + " : " + t); + + // Resynchronize clients with the server state if (worldObj != null && !this.worldObj.isRemote && this.numUsingPlayers != 0 && (this.ticksSinceSync + this.xCoord + this.yCoord + this.zCoord) % 200 == 0) { this.numUsingPlayers = 0; diff --git a/src/main/resources/assets/draconicevolution/textures/blocks/gates/fluidGate0.png b/src/main/resources/assets/draconicevolution/textures/blocks/gates/fluidGate0.png new file mode 100644 index 00000000..1c762f38 Binary files /dev/null and b/src/main/resources/assets/draconicevolution/textures/blocks/gates/fluidGate0.png differ diff --git a/src/main/resources/assets/draconicevolution/textures/blocks/gates/fluidGate1.png b/src/main/resources/assets/draconicevolution/textures/blocks/gates/fluidGate1.png new file mode 100644 index 00000000..3a115e1e Binary files /dev/null and b/src/main/resources/assets/draconicevolution/textures/blocks/gates/fluidGate1.png differ diff --git a/src/main/resources/assets/draconicevolution/textures/blocks/gates/fluidGate2.png b/src/main/resources/assets/draconicevolution/textures/blocks/gates/fluidGate2.png new file mode 100644 index 00000000..96e90301 Binary files /dev/null and b/src/main/resources/assets/draconicevolution/textures/blocks/gates/fluidGate2.png differ diff --git a/src/main/resources/assets/draconicevolution/textures/blocks/gates/fluidGate3.png b/src/main/resources/assets/draconicevolution/textures/blocks/gates/fluidGate3.png new file mode 100644 index 00000000..de242577 Binary files /dev/null and b/src/main/resources/assets/draconicevolution/textures/blocks/gates/fluidGate3.png differ diff --git a/src/main/resources/assets/draconicevolution/textures/blocks/gates/fluxGate0.png b/src/main/resources/assets/draconicevolution/textures/blocks/gates/fluxGate0.png new file mode 100644 index 00000000..2e53f993 Binary files /dev/null and b/src/main/resources/assets/draconicevolution/textures/blocks/gates/fluxGate0.png differ diff --git a/src/main/resources/assets/draconicevolution/textures/blocks/gates/fluxGate1.png b/src/main/resources/assets/draconicevolution/textures/blocks/gates/fluxGate1.png new file mode 100644 index 00000000..7642a538 Binary files /dev/null and b/src/main/resources/assets/draconicevolution/textures/blocks/gates/fluxGate1.png differ diff --git a/src/main/resources/assets/draconicevolution/textures/blocks/gates/fluxGate2.png b/src/main/resources/assets/draconicevolution/textures/blocks/gates/fluxGate2.png new file mode 100644 index 00000000..9a51b117 Binary files /dev/null and b/src/main/resources/assets/draconicevolution/textures/blocks/gates/fluxGate2.png differ diff --git a/src/main/resources/assets/draconicevolution/textures/blocks/gates/fluxGate3.png b/src/main/resources/assets/draconicevolution/textures/blocks/gates/fluxGate3.png new file mode 100644 index 00000000..62800285 Binary files /dev/null and b/src/main/resources/assets/draconicevolution/textures/blocks/gates/fluxGate3.png differ diff --git a/src/main/resources/assets/draconicevolution/textures/blocks/machine_io_i.png b/src/main/resources/assets/draconicevolution/textures/blocks/machine_io_i.png new file mode 100644 index 00000000..7048ba2f Binary files /dev/null and b/src/main/resources/assets/draconicevolution/textures/blocks/machine_io_i.png differ diff --git a/src/main/resources/assets/draconicevolution/textures/blocks/machine_io_o.png b/src/main/resources/assets/draconicevolution/textures/blocks/machine_io_o.png new file mode 100644 index 00000000..28c8e68c Binary files /dev/null and b/src/main/resources/assets/draconicevolution/textures/blocks/machine_io_o.png differ