Dev stuff is complete

This commit is contained in:
Cricket committed 2015-02-19 17:13:16 -05:00
1 parent 496ac181da
commit 530239fd72
9 files changed
+259 -530

No files matched your search

File diff suppressed because it is too large. Load diff
@@ -7,7 +7,10 @@ import com.cricketcraft.chisel.block.BlockSnakestoneObsidian;
import com.cricketcraft.chisel.block.tileentity.TileEntityAutoChisel;
import com.cricketcraft.chisel.carving.Carving;
import com.cricketcraft.chisel.config.Configurations;
import com.cricketcraft.chisel.entity.fx.*;
import com.cricketcraft.chisel.entity.fx.EntityBallOMossFX;
import com.cricketcraft.chisel.entity.fx.EntityGrimstoneFX;
import com.cricketcraft.chisel.entity.fx.EntityHolystoneFX;
import com.cricketcraft.chisel.entity.fx.EntitySnakestoneObsidianFX;
import com.cricketcraft.chisel.utils.GeneralClient;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
@@ -167,11 +170,6 @@ public class GeneralChiselClient {
}
}
public static void spawnCricketFX(World world, double x, double y, double z) {
EntityCricketFX cricket = new EntityCricketFX(world, x, y, z);
Minecraft.getMinecraft().effectRenderer.addEffect(cricket);
}
public static void spawnBallOMossFX(World world, double x, double y, double z) {
if (Configurations.particlesTickrate == 0 || tick++ % Configurations.particlesTickrate == 0) {
EntityBallOMossFX res = new EntityBallOMossFX(world, x, y, z);
@@ -260,7 +258,8 @@ public class GeneralChiselClient {
public static void spawnAutoChiselFX(TileEntityAutoChisel te, ItemStack base) {
if (base != null) {
for (int i = 0; i < 10; i++) {
EntityDiggingFX particle = new EntityDiggingFX(te.getWorldObj(), te.xCoord + 0.5, te.yCoord + 0.95, te.zCoord + 0.5, 0, 0, 0, Block.getBlockFromItem(base.getItem()), base.getItemDamage());
EntityDiggingFX particle = new EntityDiggingFX(te.getWorldObj(), te.xCoord + 0.5, te.yCoord + 0.95, te.zCoord + 0.5, 0, 0, 0, Block.getBlockFromItem(base.getItem()),
base.getItemDamage());
particle.setVelocity((te.getWorldObj().rand.nextDouble() / 4) - 0.125, te.getWorldObj().rand.nextDouble() / 8, (te.getWorldObj().rand.nextDouble() / 4) - 0.125);
Minecraft.getMinecraft().effectRenderer.addEffect(particle);
}
@@ -1,38 +1,84 @@
package com.cricketcraft.chisel.client.player;
import com.cricketcraft.chisel.client.GeneralChiselClient;
import cpw.mods.fml.common.FMLCommonHandler;
import com.cricketcraft.chisel.init.ChiselItems;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraftforge.client.event.RenderLivingEvent;
import net.minecraftforge.client.event.RenderPlayerEvent;
import org.lwjgl.opengl.GL11;
import java.util.ArrayList;
import java.util.List;
@SideOnly(Side.CLIENT)
public class PlayerSpecials {
private List<String> names = new ArrayList<String>();
private boolean resetRender;
public PlayerSpecials() {
FMLCommonHandler.instance().bus().register(this);
names.add("Cricket");
names.add("Drullkus");
}
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void renderCricket(RenderPlayerEvent event) {
if (!"TheCricket26".equals(event.entityPlayer.getDisplayName())) {
return;
public void renderItem(RenderPlayerEvent.Specials.Post event) {
EntityPlayer player = event.entityPlayer;
for (int x = 0; x < names.size(); x++) {
if (player.getCommandSenderName().equals(names.get(x))) {
GL11.glPushMatrix();
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
if (player.isSneaking()) {
GL11.glRotatef(28.64789F, 1.0F, 0.0F, 0.0F);
}
boolean armor = player.getCurrentArmor(1) != null;
GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(-0.25F, -0.85F, armor ? 0.2F : 0.28F);
GL11.glScalef(0.5F, 0.5F, 0.5F);
GL11.glColor3f(1.0F, 1.0F, 1.0F);
int light = 15728880;
int lightmapX = light % 65536;
int lightmapY = light / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY);
IIcon icon = ChiselItems.obsidianChisel.getIcon(new ItemStack(ChiselItems.obsidianChisel, 1, 0), 1);
ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 1.0F / 16.0F);
GL11.glPopMatrix();
}
}
if (event.entityPlayer.isInvisible()) {
return;
}
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void renderDev(RenderLivingEvent.Pre event) {
for (int x = 0; x < names.size(); x++) {
if (EnumChatFormatting.getTextWithoutFormattingCodes(event.entity.getCommandSenderName()).equals(names.get(x))) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F);
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
resetRender = true;
}
}
}
ModelRenderer body = null;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glPushMatrix();
GeneralChiselClient.spawnCricketFX(event.entityPlayer.getEntityWorld(), event.entityPlayer.posX, event.entityPlayer.posY, event.entityPlayer.posZ);
GL11.glPopMatrix();
@SubscribeEvent
public void entityColorRender(RenderLivingEvent.Post event) {
if (this.resetRender) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(3042);
resetRender = false;
}
}
}
@@ -1,12 +1,10 @@
package com.cricketcraft.chisel.config;
import java.util.Locale;
import com.cricketcraft.chisel.Features;
import net.minecraftforge.common.config.Configuration;
import org.apache.commons.lang3.StringUtils;
import com.cricketcraft.chisel.Features;
import java.util.Locale;
public class Configurations {
@@ -39,10 +37,12 @@ public class Configurations {
public static boolean allowChiselDamage;
public static int ironChiselMaxDamage;
public static int diamondChiselMaxDamage;
public static int obsidianChiselMaxDamage;
public static boolean ironChiselCanLeftClick;
public static boolean ironChiselHasModes;
public static int ironChiselAttackDamage;
public static int diamondChiselAttackDamage;
public static int obsidianChiselAttackDamage;
public static boolean useRoadLineTool;
public static String getRoadLineTool;
@@ -63,7 +63,8 @@ public class Configurations {
chiselRecipe = config.get(category, "chiselAlternateRecipe", false, "Use alternative crafting recipe for the chisel").getBoolean(false);
enableFMP = config.get(category, "enableFMP", true, "Do you want to enable FMP").getBoolean(true);
chiselStoneToCobbleBricks = config.get(category, "chiselStoneToCobbleBricks", true, "Chisel stone to cobblestone and bricks by left clicking.").getBoolean(false);
chiselBackToVanillaLeaves = config.get(category, "chiselBackToVanillaLeaves", false, "If this is true, you can chisel from the chisel leaves back to vanilla ones. If it is false, you cannot.").getBoolean(false);
chiselBackToVanillaLeaves = config.get(category, "chiselBackToVanillaLeaves", false, "If this is true, you can chisel from the chisel leaves back to vanilla ones. If it is false, you cannot.")
.getBoolean(false);
/* worldgen */
category = "worldgen";
@@ -87,10 +88,15 @@ public class Configurations {
allowChiselDamage = config.get(category, "allowChiselDamage", true, "Should the chisel be damageable and take damage when it chisels something.").getBoolean();
ironChiselMaxDamage = config.get(category, "ironChiselMaxDamage", 500, "The max damage of the standard iron chisel. Default: 500.").getInt();
diamondChiselMaxDamage = config.get(category, "diamondChiselMaxDamage", 5000, "The max damage of the diamond chisel. Default: 5000").getInt();
obsidianChiselMaxDamage = config.get(category, "obsidianChiselMaxDamage", 50000, "The max damage of the obsidian chisel. Default: 50000").getInt();
ironChiselCanLeftClick = config.get(category, "ironChiselCanLeftClick", true, "If this is true, the iron chisel can left click chisel blocks. If false, it cannot.").getBoolean();
ironChiselHasModes = config.get(category, "ironChiselHasModes", false, "If this is true, the iron chisel can change its chisel mode just as the diamond chisel can.").getBoolean();
ironChiselAttackDamage = config.get(category, "ironChiselAttackDamage", 2, "The extra attack damage points (in half hearts) that the iron chisel inflicts when it is used to attack an entity.").getInt();
diamondChiselAttackDamage = config.get(category, "diamondChiselAttackDamage", 2, "The extra attack damage points (in half hearts) that the diamond chisel inflicts when it is used to attack an entity.").getInt();
ironChiselAttackDamage = config.get(category, "ironChiselAttackDamage", 2, "The extra attack damage points (in half hearts) that the iron chisel inflicts when it is used to attack an entity.")
.getInt();
diamondChiselAttackDamage = config
.get(category, "diamondChiselAttackDamage", 2, "The extra attack damage points (in half hearts) that the diamond chisel inflicts when it is used to attack an entity.").getInt();
obsidianChiselAttackDamage = config
.get(category, "obsidianChiselAttackDamage", 4, "The extra attack damage points (in half hearts) that the obsidian chisel inflicts when it is used to attack an entity.").getInt();
/* block */
category = "block";
@@ -110,7 +116,9 @@ public class Configurations {
return config.get("features", featureName(feature), true).getBoolean(true) && refreshConfig();
}
/** Makes the old camelCase names from the new CONSTANT_CASE names */
/**
* Makes the old camelCase names from the new CONSTANT_CASE names
*/
public static String featureName(Features feature) {
String[] words = feature.name().toLowerCase(Locale.ENGLISH).split("_");
if (words.length == 1) {
@@ -1,106 +0,0 @@
package com.cricketcraft.chisel.entity.fx;
import com.cricketcraft.chisel.Chisel;
import com.cricketcraft.chisel.utils.General;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
public class EntityCricketFX extends EntityFX {
private double tx, ty, tz, speed;
public EntityCricketFX(World world, double x, double y, double z) {
super(world, x + 1, y + 1, z + 1);
particleScale = 0.5F + 0.5F * General.rand.nextFloat();
speed = 0.04 + 0.04 * General.rand.nextDouble();
particleMaxAge = (int) (Math.random() * 10.0D) + 40;
tx = x + General.rand.nextDouble();
ty = y + General.rand.nextDouble();
tz = z + General.rand.nextDouble();
switch (General.rand.nextInt(6)) {
case 0:
tx = x;
break;
case 1:
tx = x + 1;
break;
case 2:
ty = y;
break;
case 3:
ty = y + 1;
break;
case 4:
tz = z;
break;
case 5:
tz = z + 1;
break;
}
double dx = (tx - posX) * 3;
double dy = (ty - posY) * 3;
double dz = (tz - posZ) * 3;
setPosition(posX + dx, posY + dy + 8, posZ + dz);
prevPosX = posX;
prevPosY = posY;
prevPosZ = posZ;
noClip = true;
}
@Override
public int getFXLayer() {
return 1;
}
@Override
public void renderParticle(Tessellator tessellator, float partialTick, float rotX, float rotXZ, float rotZ, float rotYZ, float rotXY) {
super.renderParticle(tessellator, partialTick, rotX, rotXZ, rotZ, rotYZ, rotXY);
Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(Chisel.MOD_ID + ":/assets/chisel/blocks/snakestone/obsidian/particles/" + General.rand.nextInt(8) + ".png"));
if (particleAge++ >= particleMaxAge) {
setDead();
return;
}
double dx = tx - posX;
double dy = ty - posY;
double dz = tz - posZ;
double distance = Math.sqrt(dx * dx + dy * dy + dz * dz);
if (distance == 0) {
setDead();
return;
}
if (distance < 0.4) {
particleAlpha = (float) (distance / 0.4);
} else if (particleAge < 20) {
particleAlpha = 1.0F * particleAge / 20;
} else {
particleAlpha = 1.0F;
}
if (distance < speed) {
speed = distance;
}
prevPosX = posX;
prevPosY = posY;
prevPosZ = posZ;
double px = posX + dx / distance * speed;
double py = posY + dy / distance * speed;
double pz = posZ + dz / distance * speed;
setPosition(px, py, pz);
}
}
@@ -6,7 +6,6 @@ import com.cricketcraft.chisel.item.ItemCloudInABottle;
import com.cricketcraft.chisel.item.ItemSmashingRock;
import com.cricketcraft.chisel.item.ItemUpgrade;
import com.cricketcraft.chisel.item.chisel.ItemChisel;
import cpw.mods.fml.common.registry.GameRegistry.ObjectHolder;
@ObjectHolder(Chisel.MOD_ID)
@@ -14,6 +13,7 @@ public final class ChiselItems {
public static final ItemChisel chisel = null;
public static final ItemChisel diamondChisel = null;
public static final ItemChisel obsidianChisel = null;
public static final ItemCloudInABottle cloudinabottle = null;
public static final ItemBallOMoss ballomoss = null;
public static final ItemSmashingRock smashingrock = null;
@@ -1,7 +1,13 @@
package com.cricketcraft.chisel.item.chisel;
import java.util.List;
import com.cricketcraft.chisel.Chisel;
import com.cricketcraft.chisel.api.IChiselItem;
import com.cricketcraft.chisel.api.carving.ICarvingRegistry;
import com.cricketcraft.chisel.api.carving.ICarvingVariation;
import com.cricketcraft.chisel.carving.Carving;
import com.cricketcraft.chisel.config.Configurations;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import net.minecraft.block.Block;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.EntityLivingBase;
@@ -13,20 +19,14 @@ import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import com.cricketcraft.chisel.Chisel;
import com.cricketcraft.chisel.api.IChiselItem;
import com.cricketcraft.chisel.api.carving.ICarvingRegistry;
import com.cricketcraft.chisel.api.carving.ICarvingVariation;
import com.cricketcraft.chisel.carving.Carving;
import com.cricketcraft.chisel.config.Configurations;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import java.util.List;
public class ItemChisel extends Item implements IChiselItem {
public enum ChiselType {
IRON(Configurations.ironChiselMaxDamage, Configurations.ironChiselAttackDamage),
DIAMOND(Configurations.diamondChiselMaxDamage, Configurations.diamondChiselAttackDamage);
DIAMOND(Configurations.diamondChiselMaxDamage, Configurations.diamondChiselAttackDamage),
OBSIDIAN(Configurations.obsidianChiselMaxDamage, Configurations.obsidianChiselAttackDamage);
final int maxDamage;
final int attackDamage;
@@ -71,11 +71,11 @@ public class ItemChisel extends Item implements IChiselItem {
String lc2 = I18n.format(base + "lc2");
String modes = I18n.format(base + "modes");
list.add(gui);
if (type == ChiselType.DIAMOND || Configurations.ironChiselCanLeftClick) {
if (type == ChiselType.DIAMOND || type == ChiselType.OBSIDIAN || Configurations.ironChiselCanLeftClick) {
list.add(lc1);
list.add(lc2);
}
if (type == ChiselType.DIAMOND || Configurations.ironChiselHasModes) {
if (type == ChiselType.DIAMOND || type == ChiselType.OBSIDIAN || Configurations.ironChiselHasModes) {
list.add("");
list.add(modes);
}
@@ -99,7 +99,7 @@ public class ItemChisel extends Item implements IChiselItem {
stack.damageItem(1, attacker);
return super.hitEntity(stack, attacker, target);
}
@Override
public boolean canOpenGui(World world, EntityPlayer player, ItemStack chisel) {
return true;
@@ -117,11 +117,11 @@ public class ItemChisel extends Item implements IChiselItem {
@Override
public boolean canChiselBlock(World world, EntityPlayer player, int x, int y, int z, Block block, int metadata) {
return type == ChiselType.DIAMOND || Configurations.ironChiselCanLeftClick;
return type == ChiselType.DIAMOND || type == ChiselType.OBSIDIAN || Configurations.ironChiselCanLeftClick;
}
@Override
public boolean hasModes(ItemStack chisel) {
return type == ChiselType.DIAMOND || Configurations.ironChiselHasModes;
return type == ChiselType.DIAMOND || type == ChiselType.OBSIDIAN || Configurations.ironChiselHasModes;
}
}
@@ -2,6 +2,7 @@ package com.cricketcraft.chisel.proxy;
import com.cricketcraft.chisel.block.tileentity.TileEntityAutoChisel;
import com.cricketcraft.chisel.block.tileentity.TileEntityPresent;
import com.cricketcraft.chisel.client.player.PlayerSpecials;
import com.cricketcraft.chisel.client.render.*;
import com.cricketcraft.chisel.client.render.item.ItemChiselRenderer;
import com.cricketcraft.chisel.client.render.item.ItemPresentRenderer;
@@ -20,6 +21,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.MinecraftForge;
public class ClientProxy extends CommonProxy {
@@ -63,6 +65,8 @@ public class ClientProxy extends CommonProxy {
MinecraftForgeClient.registerItemRenderer(ChiselItems.chisel, renderer);
MinecraftForgeClient.registerItemRenderer(ChiselItems.diamondChisel, renderer);
MinecraftForge.EVENT_BUS.register(new PlayerSpecials());
}
@Override