new Feature

This commit is contained in:
brandon3055 committed 2014-08-15 01:35:26 +10:00
1 parent c432156fc0
commit 00a57c960c
18 files changed
+576 -53

No files matched your search

+1 -1
View File
@@ -17,7 +17,7 @@ buildscript {
apply plugin: 'forge'
version = "1.7.10-v0.9.32-Beta"
version = "1.7.10-v0.9.4-Beta-pre1"
group= "com.brandon3055.draconicevolution" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "Draconic-Evolution"
@@ -0,0 +1,21 @@
package com.brandon3055.draconicevolution.client.keybinding;
import com.brandon3055.draconicevolution.common.lib.References;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.settings.KeyBinding;
import org.lwjgl.input.Keyboard;
/**
* Created by Brandon on 14/08/2014.
*/
@SideOnly(Side.CLIENT)
public class KeyBindings {
public static KeyBinding placeItem;
public static void init() {
placeItem = new KeyBinding("key.pong", Keyboard.KEY_P, "key.categories."+ References.MODID);
ClientRegistry.registerKeyBinding(placeItem);
}
}
@@ -0,0 +1,32 @@
package com.brandon3055.draconicevolution.client.keybinding;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.network.PlacedItemPacket;
import com.brandon3055.draconicevolution.common.items.tools.ToolHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.InputEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.util.MovingObjectPosition;
/**
* Created by Brandon on 14/08/2014.
*/
public class KeyInputHandler {
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event) {
if(KeyBindings.placeItem.isPressed()) handlePlaceItemKey();
}
private void handlePlaceItemKey(){
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
WorldClient world = Minecraft.getMinecraft().theWorld;
MovingObjectPosition mop = ToolHandler.raytraceFromEntity(world, player, 4.5D);
if (mop != null) DraconicEvolution.channelHandler.sendToServer(new PlacedItemPacket((byte) mop.sideHit, mop.blockX, mop.blockY, mop.blockZ));
}
}
@@ -1,37 +1,20 @@
package com.brandon3055.draconicevolution.client.render;
import com.brandon3055.draconicevolution.common.core.handler.ParticleHandler;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser;
import com.brandon3055.draconicevolution.common.tileentities.TileParticleGenerator;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.*;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.texture.TextureUtil;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemCloth;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.MinecraftForgeClient;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import java.util.Random;
import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED;
public class EnergyInfiserRenderer extends TileEntitySpecialRenderer
{
@@ -52,7 +35,6 @@ public class EnergyInfiserRenderer extends TileEntitySpecialRenderer
GL11.glPopMatrix();
}
//And this method actually renders your tile entity
public void renderBlock(TileEnergyInfuser tile, World world, int x, int y, int z, Block block)
{
Tessellator tessellator = Tessellator.instance;
@@ -333,6 +333,7 @@ public final class Particles {
prevPosY = posY;
prevPosZ = posZ;
moveEntity(motionX, motionY, motionZ);
timer++;
}
/**Go to target and expand with timer*/
@@ -375,6 +376,7 @@ public final class Particles {
prevPosY = posY;
prevPosZ = posZ;
moveEntity(motionX, motionY, motionZ);
timer++;
}
/**Goes to target and Expand*/
@@ -405,6 +407,7 @@ public final class Particles {
prevPosY = posY;
prevPosZ = posZ;
moveEntity(motionX, motionY, motionZ);
timer++;
}
@Override
@@ -0,0 +1,171 @@
package com.brandon3055.draconicevolution.client.render;
import com.brandon3055.draconicevolution.common.items.MobSoul;
import com.brandon3055.draconicevolution.common.tileentities.TilePlacedItem;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemBow;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
/**
* Created by Brandon on 27/07/2014.
*/
public class PlacedItemRenderer extends TileEntitySpecialRenderer {
public PlacedItemRenderer()
{
}
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float timeSinceLastTick) {
if (te == null || !(te instanceof TilePlacedItem)) return;
TilePlacedItem tile = (TilePlacedItem) te;
if (tile.getStack() == null) return;
GL11.glPushMatrix();
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
GL11.glTranslated(x, y, z);
renderItem(tile);
GL11.glPopAttrib();
GL11.glPopMatrix();
}
public void renderItem(TilePlacedItem tile){
ItemStack stack = tile.getStack();
World world = Minecraft.getMinecraft().theWorld;
EntityItem itemEntity = new EntityItem(tile.getWorldObj(), 0, 0, 0, stack);
int meta = world.getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord);
//itemEntity.getEntityItem().stackSize = 1;
itemEntity.hoverStart = 0.0F;
boolean is3D = stack.getItem().isFull3D();
boolean isBlock = stack.getItem() instanceof ItemBlock;
if (isBlock){
GL11.glTranslatef(0.5F, 0.25F, 0.5F);
GL11.glScalef(1.5F, 1.5F, 1.5F);
metaAdjustBlock(meta);
GL11.glRotatef(tile.rotation, 0F, 1F, 0F);
}else if (is3D || stack.getItem() instanceof ItemArmor || stack.getItem() instanceof ItemBow){
GL11.glScalef(2F, 2F, 2F);
GL11.glRotatef(90F, -1F, 0F, 0F);
GL11.glTranslatef(0.25F, -0.45F, 0.02F);
metaAdjustItemTool(meta);
GL11.glTranslatef(0.0F, 0.21F, 0.0F);
GL11.glRotatef(tile.rotation, 0F, 0F, 1F);
GL11.glTranslatef(0.0F, -0.21F, 0.0F);
} else if (stack.getItem() instanceof MobSoul) {
GL11.glTranslatef(0.5F, 0.3F, 0.5F);
}else {
GL11.glRotatef(90F, -1F, 0F, 0F);
GL11.glTranslatef(0.5F, -0.65F, 0.02F);
metaAdjustItem(meta);
GL11.glTranslatef(0.0F, 0.18F, 0.0F);
GL11.glRotatef(tile.rotation, 0F, 0F, 1F);
GL11.glTranslatef(0.0F, -0.18F, 0.0F);
}
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
RenderItem.renderInFrame = true;
RenderManager.instance.renderEntityWithPosYaw(itemEntity, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
RenderItem.renderInFrame = false;
GL11.glDisable(GL11.GL_BLEND);
}
private void metaAdjustItemTool(int meta){
switch (meta){
case 0:
GL11.glRotatef(180F, 0F, 1F, 0F);
GL11.glTranslatef(0.0F, 0.0F, -0.46F);
break;
case 1:
break;
case 2:
GL11.glRotatef(90F, 1F, 0F, 0F);
GL11.glRotatef(180F, 0F, 1F, 0F);
GL11.glTranslatef(0.0F, 0.02F, -0.03F);
break;
case 3:
GL11.glRotatef(90F, 1F, 0F, 0F);
GL11.glTranslatef(0.0F, 0.02F, -0.43F);
break;
case 4:
GL11.glRotatef(90F, 0F, -1F, 0F);
GL11.glRotatef(90F, 0F, 0F, -1F);
GL11.glTranslatef(-0.205F, 0.02F, -0.23F);
break;
case 5:
GL11.glRotatef(90F, 0F, -1F, 0F);
GL11.glRotatef(90F, 0F, 0F, -1F);
GL11.glRotatef(180F, 0F, 1F, 0F);
GL11.glTranslatef(0.223F, 0.0F, -0.23F);
break;
}
}
private void metaAdjustItem(int meta){
switch (meta){
case 0:
GL11.glRotatef(180F, 0F, 1F, 0F);
GL11.glTranslatef(0.0F, 0.0F, -0.96F);
break;
case 1:
break;
case 2:
GL11.glRotatef(90F, 1F, 0F, 0F);
GL11.glRotatef(180F, 0F, 1F, 0F);
GL11.glTranslatef(0.0F, 0.32F, -0.33F);
break;
case 3:
GL11.glRotatef(90F, 1F, 0F, 0F);
GL11.glTranslatef(0.0F, 0.3F, -0.63F);
break;
case 4:
GL11.glRotatef(90F, 0F, -1F, 0F);
GL11.glRotatef(90F, 0F, 0F, -1F);
GL11.glTranslatef(-0.17F, 0.302F, -0.475F);
break;
case 5:
GL11.glRotatef(90F, 0F, -1F, 0F);
GL11.glRotatef(90F, 0F, 0F, -1F);
GL11.glRotatef(180F, 0F, 1F, 0F);
GL11.glTranslatef(0.15F, 0.3F, -0.475F);
break;
}
}
private void metaAdjustBlock(int meta){
switch (meta){
case 0:
GL11.glTranslatef(0.0F, 0.51F, 0.0F);
GL11.glRotatef(180F, 0F, 0F, 1F);
break;
case 1:
GL11.glTranslatef(0.0F, -0.17F, 0.0F);
break;
case 2:
GL11.glTranslatef(-0.0F, 0.17F, 0.34F);
GL11.glRotatef(90F, -1F, 0F, 0F);
break;
case 3:
GL11.glTranslatef(0.0F, 0.17F, -0.34F);
GL11.glRotatef(90F, 1F, 0F, 0F);
break;
case 4:
GL11.glTranslatef(0.34F, 0.17F, 0.0F);
GL11.glRotatef(90F, 0F, 0F, 1F);
break;
case 5:
GL11.glTranslatef(-0.34F, 0.17F, 0.0F);
GL11.glRotatef(90F, 0F, 0F, -1F);
break;
}
}
}
@@ -2,27 +2,13 @@ package com.brandon3055.draconicevolution.client.render;
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.*;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.texture.TextureUtil;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemCloth;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.MinecraftForgeClient;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
public class SoulItemRenderer implements IItemRenderer {
private Minecraft mc;
@@ -45,7 +31,10 @@ public class SoulItemRenderer implements IItemRenderer {
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
Entity mob = EntityList.createEntityByName(ItemNBTHelper.getString(item, "Name", "Pig"), mc.theWorld);
if (mob == null) {
LogHelper.error("Invalid Mob Name:" + ItemNBTHelper.getString(item, "Name", "Pig"));
mob = EntityList.createEntityByName("Pig", mc.theWorld);
}
GL11.glPushMatrix();
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
GL11.glScalef(0.5F, 0.5F, 0.5F);
@@ -89,7 +78,10 @@ public class SoulItemRenderer implements IItemRenderer {
GL11.glScalef(1.5F, 1.5F, 1.5F);
GL11.glRotatef(mc.getSystemTime() / -10, 0F, 1F, 0F);
GL11.glRotatef(-20F, 1F, 0F, 0F);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
RenderManager.instance.renderEntityWithPosYaw(mob, 0, 0, 0, 0F, 1F);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
@@ -33,6 +33,7 @@ public class ModBlocks {
public static BlockDE draconium;
public static BlockDE invisibleMultiblock;
public static BlockDE energyPylon;
public static BlockDE placedItem;
public static void init()
{
@@ -53,6 +54,7 @@ public class ModBlocks {
draconium = new Draconium();
invisibleMultiblock = new InvisibleMultiblock();
energyPylon = new EnergyPylon();
placedItem = new PlacedItem();
if(ConfigHandler.disable_LRD < 2) longRangeDislocator = new LongRangeDislocator();
if(DraconicEvolution.debug) testBlock = new TestBlock();
@@ -0,0 +1,151 @@
package com.brandon3055.draconicevolution.common.blocks;
import com.brandon3055.draconicevolution.common.lib.Strings;
import com.brandon3055.draconicevolution.common.tileentities.TilePlacedItem;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import java.util.Random;
/**
* Created by Brandon on 13/08/2014.
*/
public class PlacedItem extends BlockDE {
public PlacedItem() {
super(Material.circuits);
this.setHardness(5F);
this.setResistance(20F);
this.setBlockName(Strings.placedItemName);
ModBlocks.register(this);
}
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
switch (world.getBlockMetadata(x, y, z)){
case 0:
setBlockBounds(0.0F, 0.8F, 0.0F, 1.0F, 1.0F, 1.0F);
break;
case 1:
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.2F, 1.0F);
break;
case 2:
setBlockBounds(0.0F, 0.0F, 0.8F, 1.0F, 1.0F, 1.0F);
break;
case 3:
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.2F);
break;
case 4:
setBlockBounds(0.8F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
break;
case 5:
setBlockBounds(0.0F, 0.0F, 0.0F, 0.2F, 1.0F, 1.0F);
break;
default:
super.setBlockBoundsBasedOnState(world, x, y, z);
}
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) {
return null;
}
@Override
public int getRenderType() {
return -1;
}
@Override
public boolean hasTileEntity(int metadata) {
return true;
}
@Override
public TileEntity createTileEntity(World world, int metadata) {
return new TilePlacedItem();
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta){
TileEntity te = world.getTileEntity(x, y, z);
if (te != null && te instanceof TilePlacedItem && ((TilePlacedItem)te).getStack() != null) {
TilePlacedItem tile = (TilePlacedItem) te;
float spawnX = x + world.rand.nextFloat();
float spawnY = y + world.rand.nextFloat();
float spawnZ = z + world.rand.nextFloat();
EntityItem droppedItem = new EntityItem(world, spawnX, spawnY, spawnZ, tile.getStack());
tile.setStack(null);
float multiplier = 0.05F;
droppedItem.motionX = (-0.5F + world.rand.nextFloat()) * multiplier;
droppedItem.motionY = (4 + world.rand.nextFloat()) * multiplier;
droppedItem.motionZ = (-0.5F + world.rand.nextFloat()) * multiplier;
world.spawnEntityInWorld(droppedItem);
}
super.breakBlock(world, x, y, z, block, meta);
}
@Override
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
return null;
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) {
if (player.isSneaking()){
TilePlacedItem tile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TilePlacedItem) ? (TilePlacedItem) world.getTileEntity(x, y, z) : null;
if (tile == null) {
world.setBlockToAir(x, y, z);
}
tile.rotation += 5;
}else {
if (!world.isRemote) breakBlock(world, x, y, z, this, world.getBlockMetadata(x, y, z));
world.setBlockToAir(x, y, z);
}
return true;
}
@Override
public int getLightValue(IBlockAccess world, int x, int y, int z) {
TileEntity te = world.getTileEntity(x, y, z);
if (te != null && te instanceof TilePlacedItem && ((TilePlacedItem)te).getStack() != null) {
TilePlacedItem tile = (TilePlacedItem) te;
if (tile.getStack() != null && tile.getStack().getItem() instanceof ItemBlock) return Block.getBlockFromItem(tile.getStack().getItem()).getLightValue();
}
return 0;
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
TileEntity te = world.getTileEntity(x, y, z);
if (te != null && te instanceof TilePlacedItem && ((TilePlacedItem)te).getStack() != null) {
TilePlacedItem tile = (TilePlacedItem) te;
return tile.getStack();
}
return null;
}
}
@@ -56,9 +56,9 @@ public class CraftingHandler {
CraftingManager.getInstance().addRecipe(new ItemStack(ModItems.draconicCore), "GIG", "ISI", "GIG", 'S', Items.diamond, 'G', Items.gold_ingot, 'I', ModItems.draconiumIngot);
CraftingManager.getInstance().addRecipe(new ItemStack(ModItems.sunFocus), "RIR", "ISI", "RIR", 'S', Items.nether_star, 'R', Items.blaze_rod, 'I', ModItems.draconiumIngot);
CraftingManager.getInstance().addRecipe(new ItemStack(ModItems.infusedCompound, 2), "IDI", "DSD", "IDI", 'S', Items.nether_star, 'D', Items.diamond, 'I', ModItems.draconiumIngot);
CraftingManager.getInstance().addRecipe(new ItemStack(ModItems.dragonHeart), " C ", "CIC", " C ", 'C', ModItems.infusedCompound, 'I', ModItems.draconiumIngot);
CraftingManager.getInstance().addRecipe(new ItemStack(ModItems.dragonHeart), " C ", "CEC", " C ", 'C', ModItems.infusedCompound, 'I', Blocks.dragon_egg);
CraftingManager.getInstance().addRecipe(new ItemStack(ModItems.draconiumBlend), " D ", "DID", " D ", 'I', Items.iron_ingot, 'D', ModItems.draconiumDust);
CraftingManager.getInstance().addRecipe(new ItemStack(ModItems.draconicCompound), " C ", "CHC", " C ", 'C', ModItems.infusedCompound, 'H', ModItems.dragonHeart);
CraftingManager.getInstance().addRecipe(new ItemStack(ModItems.draconicCompound, 2), " C ", "CHC", " C ", 'C', ModItems.infusedCompound, 'H', ModItems.dragonHeart);
CraftingManager.getInstance().addRecipe(new ItemStack(ModBlocks.grinder, 1, 3), "IXI", "DCD", "IFI", 'I', Items.iron_ingot, 'X', ModItems.draconiumIngot, 'D', Items.diamond_sword, 'C', ModItems.draconicCore, 'F', Blocks.furnace);
CraftingManager.getInstance().addRecipe(new ItemStack(ModBlocks.weatherController), "RSR", "TPT", "IEI", 'R', Items.blaze_rod, 'S', ModItems.sunFocus, 'T', Blocks.tnt, 'P', ModItems.draconicCore, 'I', Items.iron_ingot, 'E', Blocks.enchanting_table);
@@ -68,11 +68,13 @@ public class CraftingHandler {
CraftingManager.getInstance().addRecipe(new ItemStack(ModBlocks.playerDetector), "ITI", "CEC", "IDI", 'I', Items.iron_ingot, 'E', Items.ender_eye, 'T', Blocks.redstone_torch, 'C', Items.comparator, 'D', ModItems.draconicCore);
CraftingManager.getInstance().addRecipe(new ItemStack(ModBlocks.playerDetectorAdvanced), "ISI", "EDE", "ICI", 'I', ModItems.draconiumIngot, 'E', Items.ender_eye, 'S', new ItemStack(Items.skull, 1, 1), 'C', Items.compass, 'D', ModBlocks.playerDetector);
CraftingManager.getInstance().addRecipe(new ItemStack(ModBlocks.generator, 1, 3), "NIN", "IFI", "NCN", 'N', Items.netherbrick, 'I', Items.iron_ingot, 'F', Blocks.furnace, 'C', ModItems.draconicCore);
CraftingManager.getInstance().addRecipe(new ItemStack(ModBlocks.energyInfuser), "IPI", "CEC", "IDI", 'I', ModItems.draconiumIngot, 'P', ModBlocks.particleGenerator, 'C', ModItems.draconicCore, 'D', ModItems.infusedCompound, 'E', Blocks.enchanting_table);
CraftingManager.getInstance().addRecipe(new ItemStack(ModBlocks.energyInfuser), "IPI", "CEC", "ICI", 'I', ModItems.draconiumIngot, 'P', ModBlocks.particleGenerator, 'C', ModItems.draconicCore, 'E', Blocks.enchanting_table);
CraftingManager.getInstance().addRecipe(new ItemStack(ModBlocks.draconium), "III", "III", "III", 'I', ModItems.draconiumIngot);
CraftingManager.getInstance().addRecipe(new ItemStack(ModBlocks.energyStorageCore), "SRS", "DCD", "SRS", 'S', Items.nether_star, 'R', Blocks.redstone_block, 'C', ModItems.draconicCore, 'D', ModBlocks.draconium);
CraftingManager.getInstance().addRecipe(new ItemStack(ModBlocks.energyStorageCore), "SRS", "DCD", "SRS", 'S', Items.nether_star, 'R', Blocks.redstone_block, 'C', ModItems.draconicCore, 'D', new ItemStack(ModBlocks.draconium, 1, 0));
CraftingManager.getInstance().addRecipe(new ItemStack(ModBlocks.energyPylon, 2), "IEI", "MCM", "IDI", 'I', ModItems.draconiumIngot, 'E', Items.ender_eye, 'C', ModItems.draconicCore, 'D', Items.diamond, 'M', Items.emerald);
CraftingManager.getInstance().addRecipe(new ItemStack(ModBlocks.draconium, 1, 1), "CSC", "SDS", "CSC", 'C', ModItems.draconicCompound, 'S', ModItems.sunFocus, 'D', new ItemStack(ModBlocks.draconium, 1, 0));
if(ConfigHandler.disableSunDial == 0)
CraftingManager.getInstance().addRecipe(new ItemStack(ModBlocks.sunDial), "IFI", "TDT", "GEG", 'I', ModItems.draconiumIngot, 'F', ModItems.sunFocus, 'T', ModItems.draconicCore, 'G', Blocks.glowstone, 'E', Blocks.enchanting_table, 'D', ModItems.dragonHeart);
if(ConfigHandler.disableXrayBlock == 0)
@@ -10,6 +10,7 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.boss.IBossDisplayData;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
@@ -80,6 +81,21 @@ public class MinecraftForgeEventHandler {
@SubscribeEvent
public void onDropEvent(LivingDropsEvent event){
if (event.entity instanceof EntityDragon && !event.entity.worldObj.isRemote){
EntityItem item = new EntityItem(event.entity.worldObj, event.entity.posX, event.entity.posY, event.entity.posZ, new ItemStack(ModItems.dragonHeart));
event.entity.worldObj.spawnEntityInWorld(item);
int count = 30 + event.entity.worldObj.rand.nextInt(30);
for (int i = 0; i < count; i++) {
float mm = 0.3F;
EntityItem item2 = new EntityItem(event.entity.worldObj, event.entity.posX-2+event.entity.worldObj.rand.nextInt(4), event.entity.posY-2+event.entity.worldObj.rand.nextInt(4), event.entity.posZ-2+event.entity.worldObj.rand.nextInt(4), new ItemStack(ModItems.draconiumDust));
item.motionX = mm * ((((float) event.entity.worldObj.rand.nextInt(100)) / 100F) - 0.5F);
item.motionY = mm * ((((float) event.entity.worldObj.rand.nextInt(100)) / 100F) - 0.5F);
item.motionZ = mm * ((((float) event.entity.worldObj.rand.nextInt(100)) / 100F) - 0.5F);
event.entity.worldObj.spawnEntityInWorld(item2);
}
}
if (event.entity.worldObj.isRemote || !(event.source.damageType.equals("player") || event.source.damageType.equals("arrow")) || !isValidEntity(event.entityLiving)){ return; }
EntityLivingBase entity = event.entityLiving;
Entity attacker = event.source.getEntity();
@@ -89,7 +105,9 @@ public class MinecraftForgeEventHandler {
int rand = random.nextInt(ConfigHandler.soulDropChance);
if (rand == 0) {
ItemStack soul = new ItemStack(ModItems.mobSoul);
ItemNBTHelper.setString(soul, "Name", entity.getCommandSenderName());
String name = entity.getCommandSenderName();
if (name.equals("Ocelot")) name = "Ozelot";
ItemNBTHelper.setString(soul, "Name", name);
world.spawnEntityInWorld(new EntityItem(world, entity.posX, entity.posY, entity.posZ, soul));
}
}
@@ -0,0 +1,75 @@
package com.brandon3055.draconicevolution.common.core.network;
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
import com.brandon3055.draconicevolution.common.tileentities.TilePlacedItem;
import io.netty.buffer.ByteBuf;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.network.NetHandlerPlayServer;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
/**
* Created by Brandon on 14/08/2014.
*/
public class PlacedItemPacket implements IPacket
{
byte side = 0;
int blockX = 0;
int blockY = 0;
int blockZ = 0;
public PlacedItemPacket() {}
public PlacedItemPacket(byte side, int x, int y, int z) {
this.side = side;
this.blockX = x;
this.blockY = y;
this.blockZ = z;
}
@Override
public void writeBytes(ByteBuf bytes){
bytes.writeByte(side);
bytes.writeInt(blockX);
bytes.writeInt(blockY);
bytes.writeInt(blockZ);
}
@Override
public void readBytes(ByteBuf bytes){
this.side = bytes.readByte();
this.blockX = bytes.readInt();
this.blockY = bytes.readInt();
this.blockZ = bytes.readInt();
}
@Override
public void handleClientSide(NetHandlerPlayClient player){
}
@Override
public void handleServerSide(NetHandlerPlayServer playerData){
ForgeDirection dir = ForgeDirection.getOrientation(side);
int x = blockX+dir.offsetX;
int y = blockY+dir.offsetY;
int z = blockZ+dir.offsetZ;
World world = playerData.playerEntity.worldObj;
EntityPlayer player = playerData.playerEntity;
if (!world.isAirBlock(x, y, z) || player.getHeldItem() == null) return;
ItemStack stack = player.getHeldItem();
world.setBlock(x, y, z, ModBlocks.placedItem, side, 2);
TilePlacedItem tile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TilePlacedItem) ? (TilePlacedItem) world.getTileEntity(x, y, z) : null;
if (tile == null){
world.setBlockToAir(x, y, z);
return;
}
tile.setStack(stack.copy());
player.destroyCurrentEquippedItem();
}
}
@@ -1,14 +1,12 @@
package com.brandon3055.draconicevolution.common.core.proxy;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.keybinding.KeyBindings;
import com.brandon3055.draconicevolution.client.render.*;
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
import com.brandon3055.draconicevolution.common.entity.EntityCustomDragon;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.tileentities.TileCustomSpawner;
import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser;
import com.brandon3055.draconicevolution.common.tileentities.TileParticleGenerator;
import com.brandon3055.draconicevolution.common.tileentities.TileTestBlock;
import com.brandon3055.draconicevolution.common.tileentities.*;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyPylon;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore;
import cpw.mods.fml.client.registry.ClientRegistry;
@@ -38,7 +36,7 @@ public class ClientProxy extends CommonProxy {
{if(debug)
System.out.println("on Client side");
super.init(event);
KeyBindings.init();
//Client Only
}
@@ -77,6 +75,9 @@ public class ClientProxy extends CommonProxy {
render = new EnergyPylonRenderer();
ClientRegistry.bindTileEntitySpecialRenderer(TileEnergyPylon.class, render);
render = new PlacedItemRenderer();
ClientRegistry.bindTileEntitySpecialRenderer(TilePlacedItem.class, render);
RenderingRegistry.registerEntityRenderingHandler(EntityCustomDragon.class, new CustomDragonRenderer());
}
}
@@ -2,6 +2,7 @@ package com.brandon3055.draconicevolution.common.core.proxy;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.interfaces.GuiHandler;
import com.brandon3055.draconicevolution.client.keybinding.KeyInputHandler;
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
import com.brandon3055.draconicevolution.common.core.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.core.handler.CraftingHandler;
@@ -67,6 +68,7 @@ public class CommonProxy {
GameRegistry.registerTileEntity(TileEnergyPylon.class, References.RESOURCESPREFIX + "TileEnergyPylon");
GameRegistry.registerTileEntity(Utills.TileBlockChanger.class, References.RESOURCESPREFIX + "TileBlockChanger");
GameRegistry.registerTileEntity(TileEnderResurrection.class, References.RESOURCESPREFIX + "TileEnderResurrection");
GameRegistry.registerTileEntity(TilePlacedItem.class, References.RESOURCESPREFIX + "TilePlacedItem");
if (DraconicEvolution.debug)
GameRegistry.registerTileEntity(TileTestBlock.class, "References.RESOURCESPREFIX + TileTestBlock");
}
@@ -74,6 +76,7 @@ public class CommonProxy {
public void registerEventListeners() {
MinecraftForge.EVENT_BUS.register(new MinecraftForgeEventHandler());
FMLCommonHandler.instance().bus().register(new FMLEventHandler());
FMLCommonHandler.instance().bus().register(new KeyInputHandler());
}
public void registerPackets() {
@@ -88,6 +91,7 @@ public class CommonProxy {
DraconicEvolution.channelHandler.registerPacket(ParticleGenPacket.class);
DraconicEvolution.channelHandler.registerPacket(PlayerDetectorStringPacket.class);
DraconicEvolution.channelHandler.registerPacket(PlayerDetectorButtonPacket.class);
DraconicEvolution.channelHandler.registerPacket(PlacedItemPacket.class);
}
public void registerGuiHandeler() {
@@ -1,7 +1,6 @@
package com.brandon3055.draconicevolution.common.entity;
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
import com.brandon3055.draconicevolution.common.items.ModItems;
import net.minecraft.block.Block;
import net.minecraft.block.BlockEndPortal;
import net.minecraft.entity.Entity;
@@ -11,10 +10,8 @@ import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.boss.EntityDragonPart;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.item.EntityEnderCrystal;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.AxisAlignedBB;
@@ -41,6 +38,7 @@ public class EntityCustomDragon extends EntityDragon {
public EntityCustomDragon(World par1World) {
super(par1World);
this.addPotionEffect(new PotionEffect(10, 600, 10, false));;
}
public EntityCustomDragon(World world, double health, float attack){
@@ -301,7 +299,9 @@ public class EntityCustomDragon extends EntityDragon {
if (worldObj.rand.nextInt(5) == 2)
{
worldObj.spawnEntityInWorld(new EntityLightningBolt(worldObj, portalX, portalY + 1, portalZ));
EntityLightningBolt bolt = new EntityLightningBolt(worldObj, portalX, portalY + 1, portalZ);
bolt.ignoreFrustumCheck = true;
worldObj.addWeatherEffect(bolt);
}
if (this.deathTicks >= 180 && this.deathTicks <= 200) {
@@ -323,14 +323,14 @@ public class EntityCustomDragon extends EntityDragon {
i -= j;
this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, j));
}
/*
float mm = 0.3F;
EntityItem item = new EntityItem(worldObj, posX, posY, posZ, new ItemStack(ModItems.draconiumDust, 3 + worldObj.rand.nextInt(3)));
item.motionX = mm * ((((float)worldObj.rand.nextInt(100))/100F) - 0.5F);
item.motionY = mm * ((((float)worldObj.rand.nextInt(100))/100F) - 0.5F);
item.motionZ = mm * ((((float)worldObj.rand.nextInt(100))/100F) - 0.5F);
worldObj.spawnEntityInWorld(item);
*/
}
if (this.deathTicks == 1) {
@@ -51,4 +51,5 @@ public class Strings {// public sta
public static final String draconiumName = "draconium";
public static final String invisibleMultiblockName = "invisibleMultiblock";
public static final String energyPylonName = "energyPylon";
public static final String placedItemName = "placedItem";
}
@@ -0,0 +1,66 @@
package com.brandon3055.draconicevolution.common.tileentities;
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
/**
* Created by Brandon on 14/08/2014.
*/
public class TilePlacedItem extends TileEntity{
public ItemStack stack;
public float rotation = 0F;
private boolean hasUpdated = false;
@Override
public void updateEntity() {
if (!hasUpdated && stack != null) {
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
hasUpdated = true;
}
}
@Override
public Packet getDescriptionPacket() {
NBTTagCompound tagCompound = new NBTTagCompound();
writeToNBT(tagCompound);
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tagCompound);
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
readFromNBT(pkt.func_148857_g());
}
public void setStack(ItemStack stack){
this.stack = stack;
worldObj.scheduleBlockUpdate(xCoord, yCoord, zCoord, ModBlocks.placedItem, 20);
}
public ItemStack getStack(){
return stack;
}
@Override
public void writeToNBT(NBTTagCompound compound) {
super.writeToNBT(compound);
NBTTagCompound[] tag = new NBTTagCompound[1];
tag[0] = new NBTTagCompound();
if (stack != null) tag[0] = stack.writeToNBT(tag[0]);
compound.setTag("Item" + 0, tag[0]);
compound.setFloat("Rotation", rotation);
}
@Override
public void readFromNBT(NBTTagCompound compound) {
super.readFromNBT(compound);
NBTTagCompound[] tag = new NBTTagCompound[1];
tag[0] = compound.getCompoundTag("Item" + 0);
stack = ItemStack.loadItemStackFromNBT(tag[0]);
rotation = compound.getFloat("Rotation");
}
}
@@ -58,7 +58,9 @@ public class TileEnderResurrection extends TileEntity{
spawn();
spawnInProgress = false;
}
timer++;
if (timer < 556 || timer > 2300)
timer++;
else timer += 2;
}
}