New pillar insert block plus textures!

This commit is contained in:
allstar69 2013-07-16 09:30:50 -07:00
commit ff271cf5f0
30 changed files with 644 additions and 36 deletions

View file

@ -12,7 +12,7 @@ import net.minecraft.util.MathHelper;
public class ItemBlockPlanks extends ItemBlock {
public static String[] PLANK_TYPE = new String[] {"Purple Planks", "Green Planks", "Black Planks", "Orange Planks", "Red Planks", "Blue Planks", "Yellow Planks"};
public static String[] PLANK_TYPE = new String[] {"Purple", "Green", "Black", "Orange", "Red", "Blue", "Yellow"};
public ItemBlockPlanks(int par1) {
super(par1);

View file

@ -21,15 +21,17 @@ public class BlockHandler {
public static Block lightCube;
public static Block pillarPlatform;
public static Block pillarTower;
public static Block pillar;
public static Block pillarInsert;
public static void init() {
oreImbuedStone = new BlockImbuedStone(BlockIds.ORE_STONE_1).setUnlocalizedName(Strings.IMBUED_STONE_NAME);
bush = new BlockBush(BlockIds.BUSH).setUnlocalizedName(Strings.BUSH_NAME);
lightCube = new BlockLightCube(BlockIds.LIGHT_CUBE).setUnlocalizedName(Strings.LIGHT_CUBE_NAME);
pillarPlatform = new BlockPillarPlatform(BlockIds.PILLAR_PLATFORM).setUnlocalizedName(Strings.PILLAR_PLATFORM_NAME);
pillarTower = new BlockPillarTower(BlockIds.PILLAR_TOWER).setUnlocalizedName(Strings.PILLAR_TOWER_NAME);
pillarPlatform = new BlockPlatform(BlockIds.PLATFORM).setUnlocalizedName(Strings.PLATFORM_NAME);
pillar = new BlockPillar(BlockIds.PILLAR).setUnlocalizedName(Strings.PILLAR_NAME);
pillarInsert = new BlockPillarInsert(BlockIds.PILLAR_INSERT).setUnlocalizedName(Strings.PILLAR_INSERT_NAME);
registerBlocks();
setBlockHarvestLevels();
@ -40,8 +42,9 @@ public class BlockHandler {
GameRegistry.registerBlock(bush, ItemBlockBush.class, Strings.BUSH_NAME);
GameRegistry.registerBlock(lightCube, Strings.LIGHT_CUBE_NAME);
GameRegistry.registerBlock(pillarPlatform, Strings.PILLAR_PLATFORM_NAME);
GameRegistry.registerBlock(pillarTower, Strings.PILLAR_TOWER_NAME);
GameRegistry.registerBlock(pillarPlatform, Strings.PLATFORM_NAME);
GameRegistry.registerBlock(pillar, Strings.PILLAR_NAME);
GameRegistry.registerBlock(pillarInsert, Strings.PILLAR_INSERT_NAME);
}
private static void setBlockHarvestLevels() {

View file

@ -0,0 +1,37 @@
package MysticWorld.Blocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import MysticWorld.MysticWorld;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
public class BlockPillar extends Block {
public BlockPillar(int id) {
super(id, Material.rock);
setBlockUnbreakable();
setResistance(6000000.0F);
setCreativeTab(MysticWorld.MysticWorldTab);
setBlockBounds(0.15F, 0.0F, 0.15F, 0.85F, 1.0F, 0.85F);
}
public boolean renderAsNormalBlock()
{
return false;
}
public boolean isOpaqueCube()
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister)
{
this.blockIcon = iconRegister.registerIcon("MysticTextures" + ":" + "Pillar");
}
}

View file

@ -0,0 +1,52 @@
package MysticWorld.Blocks;
import MysticWorld.MysticWorld;
import MysticWorld.TileEntity.TileEntityPillarInsert;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockPillarInsert extends BlockContainer {
public BlockPillarInsert(int id)
{
super(id, Material.rock);
this.setBlockUnbreakable();
this.setResistance(6000000.0F);
setCreativeTab(MysticWorld.MysticWorldTab);
setBlockBounds(0.15F, 0.0F, 0.15F, 0.85F, 1.0F, 0.85F);
}
@Override
public boolean shouldSideBeRendered(IBlockAccess blockAccess, int x, int y, int z, int i)
{
return false;
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public int getRenderType()
{
return -1;
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public TileEntity createNewTileEntity(World world) {
return new TileEntityPillarInsert();
}
}

View file

@ -0,0 +1,104 @@
package MysticWorld.Blocks;
import java.util.Random;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import MysticWorld.MysticWorld;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class BlockPlatform extends Block {
public BlockPlatform(int id) {
super(id, Material.rock);
this.setBlockUnbreakable();
this.setResistance(6000000.0F);
this.setTickRandomly(true);
setCreativeTab(MysticWorld.MysticWorldTab);
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.15F, 1.0F);
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
{
int block = BlockHandler.pillar.blockID;
double posX = (double)x;
double posY = (double)y;
double posZ = (double)z;
if (this.isTowersNearby(world, x, y, z))
{
MysticWorld.proxy.fireFX(world, posX + rand.nextDouble(), posY + 0.20, posZ + rand.nextDouble(), 1.0F);
if (rand.nextInt(3) == 0)
{
world.spawnParticle("enchantmenttable", (double)x + 0.5D, (double)y + 1.0D, (double)z + 0.5D, (double)((float)(x - 2 - x) + rand.nextFloat()) - 0.5D, (double)((float)(y + 2 - y) - rand.nextFloat() - 1.0F), (double)((float)(z - 2 - z) + rand.nextFloat()) - 0.5D);
world.spawnParticle("enchantmenttable", (double)x + 0.5D, (double)y + 1.0D, (double)z + 0.5D, (double)((float)(x - 2 - x) + rand.nextFloat()) - 0.5D, (double)((float)(y + 2 - y) - rand.nextFloat() - 1.0F), (double)((float)(z + 2 - z) + rand.nextFloat()) - 0.5D);
world.spawnParticle("enchantmenttable", (double)x + 0.5D, (double)y + 1.0D, (double)z + 0.5D, (double)((float)(x + 2 - x) + rand.nextFloat()) - 0.5D, (double)((float)(y + 2 - y) - rand.nextFloat() - 1.0F), (double)((float)(z + 2 - z) + rand.nextFloat()) - 0.5D);
world.spawnParticle("enchantmenttable", (double)x + 0.5D, (double)y + 1.0D, (double)z + 0.5D, (double)((float)(x + 2 - x) + rand.nextFloat()) - 0.5D, (double)((float)(y + 2 - y) - rand.nextFloat() - 1.0F), (double)((float)(z - 2 - z) + rand.nextFloat()) - 0.5D);
}
}
}
@Override
public void updateTick(World world, int x, int y, int z, Random random)
{
}
@Override
public int tickRate(World par1World)
{
return 30;
}
@Override
public void onEntityWalking(World world, int x, int y, int z, Entity entity)
{
super.onEntityWalking(world, x, y, z, entity);
}
private boolean isTowersNearby(World world, int x, int y, int z)
{
int pillar = BlockHandler.pillar.blockID;
int insert = BlockHandler.pillarInsert.blockID;
if (world.getBlockId(x - 2, y, z - 2) == pillar && world.getBlockId(x - 2, y, z + 2) == pillar && world.getBlockId(x + 2, y, z + 2) == pillar && world.getBlockId(x + 2, y, z - 2) == pillar
&& world.getBlockId(x - 2, y + 1, z - 2) == insert && world.getBlockId(x - 2, y + 1, z + 2) == insert && world.getBlockId(x + 2, y + 1, z + 2) == insert && world.getBlockId(x + 2, y + 1, z - 2) == insert
&& world.getBlockId(x - 2, y + 2, z - 2) == pillar && world.getBlockId(x - 2, y + 2, z + 2) == pillar && world.getBlockId(x + 2, y + 2, z + 2) == pillar && world.getBlockId(x + 2, y + 2, z - 2) == pillar)
{
return true;
}
return false;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister)
{
this.blockIcon = iconRegister.registerIcon("MysticTextures" + ":" + "Platform");
}
}

View file

@ -1,5 +1,6 @@
package MysticWorld.Client;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import net.minecraft.client.renderer.entity.RenderFireball;
import net.minecraft.item.Item;
@ -19,6 +20,8 @@ import MysticWorld.Entity.EntityChargeFire;
import MysticWorld.Entity.EntityChargeWater;
import MysticWorld.Items.ItemHandler$1;
import MysticWorld.Renderer.RenderStaffPower;
import MysticWorld.Renderer.TileEntityPillarInsertRenderer;
import MysticWorld.TileEntity.TileEntityPillarInsert;
public class ClientProxy extends CommonProxy {
@ -30,6 +33,8 @@ public class ClientProxy extends CommonProxy {
RenderingRegistry.registerEntityRenderingHandler(EntityChargeEarth.class, new RenderStaffPower(2));
RenderingRegistry.registerEntityRenderingHandler(EntityChargeAir.class, new RenderStaffPower(3));
RenderingRegistry.registerEntityRenderingHandler(EntityChargeEnergy.class, new RenderStaffPower(4));
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPillarInsert.class, new TileEntityPillarInsertRenderer());
}
public int addArmor(String armor)

View file

@ -6,8 +6,8 @@ import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import net.minecraft.src.ModLoader;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
public class PowerAirFX extends EntityFX

View file

@ -6,8 +6,8 @@ import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import net.minecraft.src.ModLoader;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
public class PowerEarthFX extends EntityFX

View file

@ -6,8 +6,8 @@ import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import net.minecraft.src.ModLoader;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
public class PowerEnergyFX extends EntityFX

View file

@ -6,8 +6,8 @@ import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import net.minecraft.src.ModLoader;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
public class PowerFireFX extends EntityFX

View file

@ -6,8 +6,8 @@ import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import net.minecraft.src.ModLoader;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
public class PowerWaterFX extends EntityFX

View file

@ -25,14 +25,16 @@ public class Config
Booleans.ENABLE_MOUNTAIN_GEN = config.get("World Generation", "Enable Mountain Biome", true).getBoolean(Booleans.ENABLE_MOUNTAIN_GEN);
Booleans.ENABLE_STEPPE_GEN = config.get("World Generation", "Enable Steppe Biome", true).getBoolean(Booleans.ENABLE_STEPPE_GEN);
Booleans.ENABLE_TUNDRA_GEN = config.get("World Generation", "Enable Tundra Biome", true).getBoolean(Booleans.ENABLE_TUNDRA_GEN);
Booleans.VANILLA_OVERRIDE_ENABLE = config.get("Vanilla Override", "Enable Vanilla Block Override", true).getBoolean(Booleans.VANILLA_OVERRIDE_ENABLE);
//Block Configuration
BlockIds.ORE_STONE_1 = config.getBlock(Strings.IMBUED_STONE_NAME, BlockIds.ORE_STONE_1_DEFAULT).getInt(BlockIds.ORE_STONE_1);
BlockIds.BUSH = config.getBlock(Strings.BUSH_NAME, BlockIds.BUSH_DEFAULT).getInt(BlockIds.BUSH_DEFAULT);
BlockIds.LIGHT_CUBE = config.getBlock(Strings.LIGHT_CUBE_NAME, BlockIds.LIGHT_CUBE_DEFAULT).getInt(BlockIds.LIGHT_CUBE_DEFAULT);
BlockIds.PILLAR_PLATFORM = config.getBlock(Strings.PILLAR_PLATFORM_NAME, BlockIds.PILLAR_PLATFORM_DEFAULT).getInt(BlockIds.PILLAR_PLATFORM_DEFAULT);
BlockIds.PILLAR_TOWER = config.getBlock(Strings.PILLAR_TOWER_NAME, BlockIds.PILLAR_TOWER_DEFAULT).getInt(BlockIds.PILLAR_TOWER_DEFAULT);
BlockIds.PLATFORM = config.getBlock(Strings.PLATFORM_NAME, BlockIds.PLATFORM_DEFAULT).getInt(BlockIds.PLATFORM_DEFAULT);
BlockIds.PILLAR = config.getBlock(Strings.PILLAR_NAME, BlockIds.PILLAR_DEFAULT).getInt(BlockIds.PILLAR_DEFAULT);
BlockIds.PILLAR_INSERT = config.getBlock(Strings.PILLAR_INSERT_NAME, BlockIds.PILLAR_INSERT_DEFAULT).getInt(BlockIds.PILLAR_INSERT_DEFAULT);
//Item Configuration
ItemIds.IMBUED_SHARD = config.getItem(Strings.IMBUED_SHARD_NAME, ItemIds.IMBUED_SHARD_DEFAULT).getInt(ItemIds.IMBUED_SHARD_DEFAULT);

View file

@ -0,0 +1,132 @@
package MysticWorld.Entity;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.ai.EntityAIControlledByPlayer;
import net.minecraft.entity.ai.EntityAIFollowParent;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIMate;
import net.minecraft.entity.ai.EntityAIPanic;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAITempt;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.monster.EntityPigZombie;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.stats.AchievementList;
import net.minecraft.world.World;
public class EntityPigman extends EntityAnimal
{
public EntityPigman(World par1World)
{
super(par1World);
this.setSize(0.9F, 0.9F);
this.getNavigator().setAvoidsWater(true);
float f = 0.25F;
this.tasks.addTask(0, new EntityAISwimming(this));
this.tasks.addTask(1, new EntityAIPanic(this, 0.38F));
this.tasks.addTask(3, new EntityAIMate(this, f));
this.tasks.addTask(4, new EntityAITempt(this, 0.3F, Item.carrot.itemID, false));
this.tasks.addTask(5, new EntityAIFollowParent(this, 0.28F));
this.tasks.addTask(6, new EntityAIWander(this, f));
this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
this.tasks.addTask(8, new EntityAILookIdle(this));
}
public boolean isAIEnabled()
{
return true;
}
public int getMaxHealth()
{
return 20;
}
protected void updateAITasks()
{
super.updateAITasks();
}
protected void entityInit()
{
super.entityInit();
this.dataWatcher.addObject(16, Byte.valueOf((byte)0));
}
protected String getLivingSound()
{
return "mob.pig.say";
}
protected String getHurtSound()
{
return "mob.pig.say";
}
protected String getDeathSound()
{
return "mob.pig.death";
}
protected void playStepSound(int par1, int par2, int par3, int par4)
{
this.playSound("mob.pig.step", 0.15F, 1.0F);
}
protected int getDropItemId()
{
return this.isBurning() ? Item.porkCooked.itemID : Item.porkRaw.itemID;
}
protected void dropFewItems(boolean par1, int par2)
{
int j = this.rand.nextInt(3) + 1 + this.rand.nextInt(1 + par2);
for (int k = 0; k < j; ++k)
{
if (this.isBurning())
{
this.dropItem(Item.porkCooked.itemID, 1);
}
else
{
this.dropItem(Item.porkRaw.itemID, 1);
}
}
}
public void onStruckByLightning(EntityLightningBolt par1EntityLightningBolt)
{
if (!this.worldObj.isRemote)
{
EntityPigZombie entitypigzombie = new EntityPigZombie(this.worldObj);
entitypigzombie.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
this.worldObj.spawnEntityInWorld(entitypigzombie);
this.setDead();
}
}
public EntityPigman spawnBabyAnimal(EntityAgeable par1EntityAgeable)
{
return new EntityPigman(this.worldObj);
}
public boolean isBreedingItem(ItemStack par1ItemStack)
{
return par1ItemStack != null && par1ItemStack.itemID == Item.carrot.itemID;
}
public EntityAgeable createChild(EntityAgeable par1EntityAgeable)
{
return this.spawnBabyAnimal(par1EntityAgeable);
}
}

View file

@ -35,7 +35,8 @@ public class Lang
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.lightCube, 1), "Light Cube");
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.pillarPlatform, 1), "Pillar Platform");
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.pillarTower, 1), "Pillar Tower");
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.pillar, 1), "Pillar Tower");
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.pillarInsert, 1), "Pillar Insert");
//Items
LanguageRegistry.instance().addName(new ItemStack(ItemHandler$1.staffParts, 1, 0), "Staff");

View file

@ -20,8 +20,9 @@ public class BlockIds {
public static int LIGHT_CUBE_DEFAULT = 613;
public static int PILLAR_PLATFORM_DEFAULT = 614;
public static int PILLAR_TOWER_DEFAULT = 615;
public static int PLATFORM_DEFAULT = 614;
public static int PILLAR_DEFAULT = 615;
public static int PILLAR_INSERT_DEFAULT = 616;
//Current Block IDs
public static int ORE_STONE_1;
@ -41,7 +42,8 @@ public class BlockIds {
public static int LIGHT_CUBE;
public static int PILLAR_PLATFORM;
public static int PILLAR_TOWER;
public static int PLATFORM;
public static int PILLAR;
public static int PILLAR_INSERT;
}

View file

@ -20,8 +20,9 @@ public class Strings {
public static final String LIGHT_CUBE_NAME = "lightCube";
public static final String PILLAR_PLATFORM_NAME = "pillarPlatform";
public static final String PILLAR_TOWER_NAME = "pillarTower";
public static final String PLATFORM_NAME = "platform";
public static final String PILLAR_NAME = "pillar";
public static final String PILLAR_INSERT_NAME = "pillarInsert";
//Item Names
public static final String STAFF_HILT_NAME = "staffHilt";
@ -76,8 +77,9 @@ public class Strings {
public static final String ENTITY_ENERGY_CHARGE_NAME = "entityEnergyCharge";
public static final String ENTITY_WATER_CHARGE_NAME = "entityWaterCharge";
public static final String ENTITY_PIGMAN_NAME = "entityPigman";
//Tile Entity Names
public static final String PILLAR_INSERT_TE_NAME = "pillarInsert";
//Config Category Names
public static final String ENTITY_CATEGORY = "entity";
public static final String ENTITY_CATEGORY = "entity";
}

View file

@ -0,0 +1,79 @@
package MysticWorld.Model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
public class ModelPillarInsert extends ModelBase
{
ModelRenderer Plate1;
ModelRenderer Plate2;
ModelRenderer smallPlate1;
ModelRenderer smallPlate2;
public ModelPillarInsert()
{
textureWidth = 64;
textureHeight = 64;
Plate1 = new ModelRenderer(this, 0, 0);
Plate1.addBox(0F, 0F, 0F, 12, 2, 12);
Plate1.setRotationPoint(-6F, 22F, -6F);
Plate1.setTextureSize(64, 32);
setRotation(Plate1, 0F, 0F, 0F);
Plate2 = new ModelRenderer(this, 0, 0);
Plate2.addBox(0F, 0F, 0F, 12, 2, 12);
Plate2.setRotationPoint(-6F, 8F, -6F);
Plate2.setTextureSize(64, 32);
setRotation(Plate2, 0F, 0F, 0F);
smallPlate1 = new ModelRenderer(this, 0, 0);
smallPlate1.addBox(0F, 0F, 0F, 8, 2, 8);
smallPlate1.setRotationPoint(-4F, 10F, -4F);
smallPlate1.setTextureSize(64, 32);
setRotation(smallPlate1, 0F, 0F, 0F);
smallPlate2 = new ModelRenderer(this, 0, 0);
smallPlate2.addBox(0F, 0F, 0F, 8, 2, 8);
smallPlate2.setRotationPoint(-4F, 20F, -4F);
smallPlate2.setTextureSize(64, 32);
setRotation(smallPlate2, 0F, 0F, 0F);
}
@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
super.render(entity, f, f1, f2, f3, f4, f5);
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
Plate1.render(f5);
Plate2.render(f5);
smallPlate1.render(f5);
smallPlate2.render(f5);
}
public void renderModel (float f1)
{
Plate1.render(f1);
Plate2.render(f1);
smallPlate1.render(f1);
smallPlate2.render(f1);
}
@Override
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
{
super.setRotationAngles(f, f1, f2, f3, f4, f5, null);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}

View file

@ -7,16 +7,16 @@ import java.util.Set;
import MysticWorld.Biome.BiomeHandler;
import MysticWorld.Blocks.BlockHandler;
import MysticWorld.Blocks.Override.OverrideManager;
import MysticWorld.Entity.EntityHandler;
import MysticWorld.Items.ItemHandler$1;
import MysticWorld.Lib.Strings;
import MysticWorld.TileEntity.TileEntityHandler;
import MysticWorld.WorldGen.*;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.util.ResourceLocation;
import net.minecraft.client.resources.ResourceLocation;
import net.minecraft.world.WorldType;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.ChestGenHooks;
@ -75,13 +75,18 @@ public class MysticWorld
VillagerRegistry.instance().registerVillagerSkin(98943, new ResourceLocation("/mods/MysticTextures/textures/mob/MysticVillager.png"));
VillagerRegistry.instance().registerVillageTradeHandler(98943, new VillageHutHandler());
VillagerRegistry.instance().registerVillageCreationHandler(new VillageHutHandler());
OverrideManager.init();
BlockHandler.init();
ItemHandler$1.init();
TileEntityHandler.init();
WorldGenHandler$1.init();
EntityHandler.init();
RecipeHandler.init();
MysticHutUtil.addLoot();
Lang.init();
}
@EventHandler
public void postInit(FMLPostInitializationEvent event)
{
}
}

View file

@ -9,7 +9,6 @@ import MysticWorld.Items.ItemStaffPower;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.util.ResourceLocation;
import net.minecraft.entity.Entity;
import net.minecraft.entity.projectile.EntityFireball;
import net.minecraft.entity.projectile.EntityPotion;
@ -17,6 +16,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemPotion;
import net.minecraft.potion.PotionHelper;
import net.minecraft.util.Icon;
import net.minecraft.util.ResourceLocation;
public class RenderStaffPower extends Render {

View file

@ -0,0 +1,47 @@
package MysticWorld.Renderer;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
import MysticWorld.Blocks.BlockHandler;
import MysticWorld.Model.ModelPillarInsert;
import MysticWorld.TileEntity.TileEntityPillarInsert;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
public class TileEntityPillarInsertRenderer extends TileEntitySpecialRenderer {
private static final ResourceLocation texture = new ResourceLocation("mystictextures:textures" + "/blocks/PillarInsert.png");
private ModelPillarInsert model;
public TileEntityPillarInsertRenderer()
{
model = new ModelPillarInsert();
}
public void renderAModelAt(TileEntityPillarInsert tileentity, double d, double d1, double d2, float f)
{
GL11.glPushMatrix();
GL11.glTranslatef((float)d + 0.5F, (float)d1 + 1.52F, (float)d2 + 0.5F);
GL11.glRotatef(180F, 0F, 0F, 1F);
this.func_110628_a(texture);
GL11.glPushMatrix();
model.renderModel(0.0625F);
GL11.glPopMatrix();
GL11.glPopMatrix();
}
public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f)
{
renderAModelAt((TileEntityPillarInsert)tileentity, d, d1, d2, f);
}
}

View file

@ -6,14 +6,18 @@ import java.util.Random;
import MysticWorld.Blocks.BlockBush;
import MysticWorld.Blocks.BlockHandler;
import MysticWorld.Blocks.BlockPlatform;
import MysticWorld.Items.ItemHandler$1;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.entity.projectile.EntityPotion;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.AxisAlignedBB;
@ -26,6 +30,8 @@ public class TickHandler implements IScheduledTickHandler
{
private EnumSet ticks;
public static final Enchantment[] enchantmentsPick = { Enchantment.efficiency, Enchantment.fortune, Enchantment.silkTouch, Enchantment.unbreaking };
public TickHandler(){
this.ticks = EnumSet.of(TickType.PLAYER);
}
@ -39,7 +45,7 @@ public class TickHandler implements IScheduledTickHandler
staffAndOrbTick(player, world, itemstack, rand);
pillarTick(player, world);
pillarTick(player, world, inventory, rand);
}
public void tickEnd(EnumSet<TickType> type, Object... tickData){
@ -60,15 +66,66 @@ public class TickHandler implements IScheduledTickHandler
return 20;
}
private static void pillarTick(EntityPlayer player, World world)
private static void pillarTick(EntityPlayer player, World world, InventoryPlayer inventory, Random rand)
{
int block = world.getBlockId((int)player.posX, (int)player.posY, (int)player.posZ);
int foodLevel = player.getFoodStats().getFoodLevel();
if (block == BlockHandler.pillarPlatform.blockID)
{
player.getFoodStats().setFoodLevel(foodLevel + 1);
player.getFoodStats().setFoodSaturationLevel(20);
ItemStack itemStack = inventory.getCurrentItem();
int blockX = (int)player.posX - 1;
int blockY = (int)(player.posY - 0.15D);
int blockZ = (int)player.posZ - 1;
int blockId = world.getBlockId(blockX, blockY, blockZ);
int blockMeta = world.getBlockMetadata(blockX, blockY, blockZ);
if (blockId == BlockHandler.pillarPlatform.blockID)
{
switch (blockMeta)
{
//food
case 0:
int foodLevel = player.getFoodStats().getFoodLevel();
player.getFoodStats().setFoodLevel((int)((double)foodLevel + 0.5D));
player.getFoodStats().setFoodSaturationLevel(20);
break;
//regeneration
case 1:
player.addPotionEffect(new PotionEffect(Potion.regeneration.getId(), 6000, 4));
break;
//speed
case 2:
player.addPotionEffect(new PotionEffect(Potion.moveSpeed.getId(), 6000, 4));
break;
//haste
case 3:
player.addPotionEffect(new PotionEffect(Potion.digSpeed.getId(), 6000, 4));
break;
//resistance
case 4:
player.addPotionEffect(new PotionEffect(Potion.resistance.getId(), 6000, 4));
break;
//jump boost
case 5:
player.addPotionEffect(new PotionEffect(Potion.jump.getId(), 6000, 4));
break;
//fire
case 6:
player.addPotionEffect(new PotionEffect(Potion.fireResistance.getId(), 6000, 4));
break;
//enchanter
case 7:
if (itemStack != null && (itemStack.itemID == Item.pickaxeWood.itemID || itemStack.itemID == Item.pickaxeStone.itemID ||
itemStack.itemID == Item.pickaxeIron.itemID || itemStack.itemID == Item.pickaxeGold.itemID || itemStack.itemID == Item.pickaxeDiamond.itemID))
{
if (itemStack.isItemEnchanted() != true && player.experienceLevel >= 10)
{
player.experienceLevel -= 10;
itemStack.addEnchantment(enchantmentsPick[rand.nextInt(3)], rand.nextInt(4) + 1);
}
}
break;
default:
break;
}
}
}

View file

@ -0,0 +1,13 @@
package MysticWorld.TileEntity;
import cpw.mods.fml.common.registry.GameRegistry;
import MysticWorld.Lib.Strings;
public class TileEntityHandler {
public static void init()
{
GameRegistry.registerTileEntity(TileEntityPillarInsert.class, Strings.PILLAR_INSERT_TE_NAME);
}
}

View file

@ -0,0 +1,37 @@
package MysticWorld.TileEntity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.Packet132TileEntityData;
import net.minecraft.tileentity.TileEntity;
public class TileEntityPillarInsert extends TileEntity {
@Override
public Packet getDescriptionPacket()
{
NBTTagCompound nbtTag = new NBTTagCompound();
this.writeToNBT(nbtTag);
return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, 1, nbtTag);
}
@Override
public void onDataPacket(INetworkManager net, Packet132TileEntityData packet)
{
readFromNBT(packet.customParam1);
}
@Override
public void writeToNBT(NBTTagCompound par1)
{
super.writeToNBT(par1);
}
@Override
public void readFromNBT(NBTTagCompound par1)
{
super.readFromNBT(par1);
}
}

View file

@ -0,0 +1,30 @@
package MysticWorld.WorldGen;
import java.util.Random;
import MysticWorld.*;
import MysticWorld.Items.ItemHandler$1;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.village.MerchantRecipe;
import net.minecraft.village.MerchantRecipeList;
import cpw.mods.fml.common.registry.VillagerRegistry.IVillageTradeHandler;
public class MysticVillagerTrades implements IVillageTradeHandler
{
@Override
public void manipulateTradesForVillager (EntityVillager villager, MerchantRecipeList recipeList, Random random)
{
if (villager.getProfession() == 98943)
{
recipeList.addToListWithCheck(new MerchantRecipe(new ItemStack(ItemHandler$1.imbuedShard, 19, 0), new ItemStack(Item.emerald, 1, 0)));
recipeList.addToListWithCheck(new MerchantRecipe(new ItemStack(ItemHandler$1.imbuedShard, 16, 1), new ItemStack(Item.emerald, 1, 0)));
recipeList.addToListWithCheck(new MerchantRecipe(new ItemStack(ItemHandler$1.imbuedShard, 17, 2), new ItemStack(Item.emerald, 1, 0)));
recipeList.addToListWithCheck(new MerchantRecipe(new ItemStack(ItemHandler$1.imbuedShard, 13, 3), new ItemStack(Item.emerald, 1, 0)));
recipeList.addToListWithCheck(new MerchantRecipe(new ItemStack(ItemHandler$1.imbuedShard, 11, 4), new ItemStack(Item.emerald, 1, 0)));
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 444 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 837 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 442 B