feat: implement planks, slabs and particles
This commit is contained in:
parent
34dbac45e9
commit
fa6ad449f0
|
@ -5,7 +5,7 @@ import java.util.stream.IntStream;
|
|||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ley.modding.dartcraft.item.ItemBlockForceBrick;
|
||||
import ley.modding.dartcraft.item.AbstractItemBlockMetadata;
|
||||
import ley.modding.dartcraft.util.DartUtils;
|
||||
import ley.modding.dartcraft.util.FXUtils;
|
||||
import ley.modding.dartcraft.util.Util;
|
||||
|
@ -99,13 +99,13 @@ public class BlockForceBrick extends Block implements ICustomItemBlockProvider {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: WTF
|
||||
//@Override
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean addBlockDestroyEffects(
|
||||
public boolean addDestroyEffects(
|
||||
World world, int x, int y, int z, int meta, EffectRenderer renderer
|
||||
) {
|
||||
int color = world.getBlockMetadata(x, y, z);
|
||||
System.out.println("ALEC: " + color + " " + Integer.toHexString(DartUtils.getMcColor(color)));
|
||||
FXUtils.makeShiny(
|
||||
world,
|
||||
(double) x,
|
||||
|
@ -119,10 +119,9 @@ public class BlockForceBrick extends Block implements ICustomItemBlockProvider {
|
|||
return true;
|
||||
}
|
||||
|
||||
// TODO: WTF
|
||||
//@Override
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean addBlockHitEffects(
|
||||
public boolean addHitEffects(
|
||||
World world, MovingObjectPosition target, EffectRenderer renderer
|
||||
) {
|
||||
int color = world.getBlockMetadata(target.blockX, target.blockY, target.blockZ);
|
||||
|
@ -150,6 +149,17 @@ public class BlockForceBrick extends Block implements ICustomItemBlockProvider {
|
|||
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlockClass() {
|
||||
return ItemBlockForceBrick.class;
|
||||
return BlockItem.class;
|
||||
}
|
||||
|
||||
public static class BlockItem extends AbstractItemBlockMetadata {
|
||||
public BlockItem(Block block) {
|
||||
super(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getID() {
|
||||
return "forcebrick";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import ley.modding.dartcraft.util.Util;
|
|||
import net.minecraft.block.BlockLog;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class BlockForceLog extends BlockLog {
|
||||
private IIcon sideIcon;
|
||||
|
@ -29,4 +30,19 @@ public class BlockForceLog extends BlockLog {
|
|||
protected IIcon getSideIcon(int p_150163_1_) {
|
||||
return this.sideIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSustainLeaves(IBlockAccess arg0, int arg1, int arg2, int arg3) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeReplacedByLeaves(IBlockAccess arg0, int arg1, int arg2, int arg3) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWood(IBlockAccess arg0, int arg1, int arg2, int arg3) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package ley.modding.dartcraft.block;
|
||||
|
||||
import ley.modding.dartcraft.util.Util;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
||||
public class BlockForcePlanks extends Block {
|
||||
public BlockForcePlanks() {
|
||||
super(Material.wood);
|
||||
Util.configureBlock(this, "forceplanks");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister reg) {
|
||||
this.blockIcon = reg.registerIcon("dartcraft:wood");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,263 @@
|
|||
package ley.modding.dartcraft.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ley.modding.dartcraft.Dartcraft;
|
||||
import ley.modding.dartcraft.item.AbstractItemBlockMetadata;
|
||||
import ley.modding.dartcraft.tile.TileEntityStairs;
|
||||
import ley.modding.dartcraft.util.DartUtils;
|
||||
import ley.modding.dartcraft.util.FXUtils;
|
||||
import ley.modding.dartcraft.util.Util;
|
||||
import ley.modding.tileralib.api.ICustomItemBlockProvider;
|
||||
import ley.modding.tileralib.api.ITEProvider;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.particle.EffectRenderer;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.EnumCreatureType;
|
||||
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.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockForceSlab
|
||||
extends BlockSlab implements ITEProvider, ICustomItemBlockProvider {
|
||||
public BlockForceSlab() {
|
||||
super(false, Material.rock);
|
||||
Util.configureBlock(this, "forceslab");
|
||||
this.setHardness(2.0F);
|
||||
this.setResistance(2000.0F);
|
||||
this.setStepSound(Block.soundTypeStone);
|
||||
this.setLightOpacity(0);
|
||||
// TODO: WTF
|
||||
//Block.useNeighborBrightness[id] = true;
|
||||
}
|
||||
|
||||
// TODO: WTF
|
||||
//@Override
|
||||
//public String getFullSlabName(int var1) {
|
||||
// return "forceSlab";
|
||||
//}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(
|
||||
MovingObjectPosition arg0,
|
||||
World arg1,
|
||||
int arg2,
|
||||
int arg3,
|
||||
int arg4,
|
||||
EntityPlayer arg5
|
||||
) {
|
||||
return new ItemStack(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public void getSubBlocks(Item id, CreativeTabs tab, List list) {
|
||||
IntStream.range(0, 17)
|
||||
.mapToObj(i -> new ItemStack(this, 1, i))
|
||||
.forEach(list::add);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(
|
||||
IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5
|
||||
) {
|
||||
return !(
|
||||
par5 != 1 && par5 != 0
|
||||
&& !super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean
|
||||
canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(int meta) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int meta) {
|
||||
return new TileEntityStairs();
|
||||
}
|
||||
|
||||
public static TileEntityStairs getStairTile(IBlockAccess world, int x, int y, int z) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
return tile != null && tile instanceof TileEntityStairs ? (TileEntityStairs) tile
|
||||
: null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean
|
||||
removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean alec) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (Dartcraft.proxy.isSimulating(world) && this.canHarvestBlock(player, meta)
|
||||
&& !player.capabilities.isCreativeMode) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileEntityStairs) {
|
||||
TileEntityStairs stairs = (TileEntityStairs) tile;
|
||||
ItemStack stack = new ItemStack(this, 1, stairs.color);
|
||||
DartUtils.dropItem(stack, world, (double) x, (double) y, (double) z);
|
||||
}
|
||||
}
|
||||
|
||||
return world.setBlockToAir(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack>
|
||||
getDrops(World alec1, int alec2, int alec3, int alec4, int alec5, int alec6) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onBlockPlaced(
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
int par5,
|
||||
float par6,
|
||||
float par7,
|
||||
float par8,
|
||||
int par9
|
||||
) {
|
||||
TileEntityStairs stairs = getStairTile(world, x, y, z);
|
||||
if (stairs != null) {
|
||||
stairs.color = world.getBlockMetadata(x, y, z);
|
||||
stairs.markDirty();
|
||||
}
|
||||
|
||||
return par5 != 0 && (par5 == 1 || (double) par7 <= 0.5D) ? 0 : 8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(
|
||||
World par1World,
|
||||
int par2,
|
||||
int par3,
|
||||
int par4,
|
||||
EntityLivingBase entity,
|
||||
ItemStack stack
|
||||
) {
|
||||
TileEntityStairs stairs = getStairTile(par1World, par2, par3, par4);
|
||||
if (stack != null && stairs != null) {
|
||||
stairs.color = stack.getItemDamage();
|
||||
stairs.markDirty();
|
||||
}
|
||||
|
||||
super.onBlockPlacedBy(par1World, par2, par3, par4, entity, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int alec, int meta) {
|
||||
return meta == 16 ? DartBlocks.forceplanks.getIcon(0, 0)
|
||||
: ((BlockForceBrick) DartBlocks.forcebrick).icons[meta];
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntityStairs stairs = getStairTile(world, x, y, z);
|
||||
if (stairs != null && stairs.color >= 0) {
|
||||
if (stairs.color < 16) {
|
||||
return ((BlockForceBrick) DartBlocks.forcebrick).icons[stairs.color];
|
||||
}
|
||||
|
||||
if (stairs.color == 16) {
|
||||
return DartBlocks.forceplanks.getIcon(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean addDestroyEffects(
|
||||
World world, int x, int y, int z, int meta, EffectRenderer renderer
|
||||
) {
|
||||
TileEntityStairs stairs = getStairTile(world, x, y, z);
|
||||
if (stairs != null) {
|
||||
FXUtils.makeShiny(
|
||||
world,
|
||||
(double) x,
|
||||
(double) y,
|
||||
(double) z,
|
||||
2,
|
||||
DartUtils.getMcColor(stairs.color),
|
||||
32,
|
||||
true
|
||||
);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean addHitEffects(
|
||||
World world, MovingObjectPosition target, EffectRenderer renderer
|
||||
) {
|
||||
TileEntityStairs stairs
|
||||
= getStairTile(world, target.blockX, target.blockY, target.blockZ);
|
||||
if (stairs != null) {
|
||||
FXUtils.makeShiny(
|
||||
world,
|
||||
(double) target.blockX,
|
||||
(double) target.blockY,
|
||||
(double) target.blockZ,
|
||||
2,
|
||||
DartUtils.getMcColor(stairs.color),
|
||||
4,
|
||||
true
|
||||
);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTEClass() {
|
||||
return TileEntityStairs.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String func_150002_b(int arg0) {
|
||||
throw new UnsupportedOperationException("ALEC");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlockClass() {
|
||||
return BlockItem.class;
|
||||
}
|
||||
|
||||
public static class BlockItem extends AbstractItemBlockMetadata {
|
||||
public BlockItem(Block block) {
|
||||
super(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getID() {
|
||||
return "forceslab";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,7 +10,9 @@ public class DartBlocks {
|
|||
public static Block forcebrick;
|
||||
public static Block forceleaves;
|
||||
public static Block forcelog;
|
||||
public static Block forceplanks;
|
||||
public static Block forcesapling;
|
||||
public static Block forceslab;
|
||||
public static Block liquidforce;
|
||||
public static Block powerore;
|
||||
|
||||
|
@ -25,7 +27,9 @@ public class DartBlocks {
|
|||
DartBlocks.forcebrick = reg.registerBlock(new BlockForceBrick());
|
||||
DartBlocks.forceleaves = reg.registerBlock(new BlockForceLeaves());
|
||||
DartBlocks.forcelog = reg.registerBlock(new BlockForceLog());
|
||||
DartBlocks.forceplanks = reg.registerBlock(new BlockForcePlanks());
|
||||
DartBlocks.forcesapling = reg.registerBlock(new BlockForceSapling());
|
||||
DartBlocks.forceslab = reg.registerBlock(new BlockForceSlab());
|
||||
DartBlocks.liquidforce = reg.registerBlock(new BlockLiquidForce());
|
||||
DartBlocks.powerore = reg.registerBlock(new BlockPowerOre());
|
||||
}
|
||||
|
|
|
@ -0,0 +1,160 @@
|
|||
package ley.modding.dartcraft.client.fx;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import ley.modding.dartcraft.Dartcraft;
|
||||
import ley.modding.dartcraft.proxy.CommonProxy;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class FXDisney extends EntityFX {
|
||||
public static final int TYPE_FALL = 0;
|
||||
public static final int TYPE_CHANGE = 1;
|
||||
public static final int TYPE_BREAK = 2;
|
||||
private int iconIndex = 0;
|
||||
private int changeTime;
|
||||
private int type;
|
||||
private Color color;
|
||||
|
||||
public FXDisney(
|
||||
World world, double x, double y, double z, double vx, double vy, double vz
|
||||
) {
|
||||
super(world, x, y, z, vx, vy, vz);
|
||||
}
|
||||
|
||||
public FXDisney(World world, double x, double y, double z, int color, int type) {
|
||||
super(world, x, y, z);
|
||||
this.color = new Color(color);
|
||||
this.particleRed = ((float) this.color.getRed()) / 255f;
|
||||
this.particleGreen = ((float) this.color.getGreen()) / 255f;
|
||||
this.particleBlue = ((float) this.color.getBlue()) / 255f;
|
||||
this.setSize(0.01F, 0.01F);
|
||||
this.changeTime = 0;
|
||||
this.noClip = true;
|
||||
this.type = type;
|
||||
float velModifier;
|
||||
switch (type) {
|
||||
case 0:
|
||||
this.motionX = this.motionZ = 0.0D;
|
||||
this.motionY = -0.025D;
|
||||
this.particleMaxAge = (int) (85.0D
|
||||
* ((double) world.rand.nextFloat() * 0.2D
|
||||
+ 0.8999999761581421D));
|
||||
break;
|
||||
case 1:
|
||||
velModifier = 0.25F;
|
||||
this.motionX = (double) ((CommonProxy.rand.nextFloat() * 2.0F - 1.0F)
|
||||
* velModifier);
|
||||
this.motionY = (double) ((CommonProxy.rand.nextFloat() * 2.0F - 1.0F)
|
||||
* velModifier);
|
||||
this.motionZ = (double) ((CommonProxy.rand.nextFloat() * 2.0F - 1.0F)
|
||||
* velModifier);
|
||||
this.particleMaxAge = (int) (10.0D
|
||||
* ((double) world.rand.nextFloat() * 0.2D
|
||||
+ 0.8999999761581421D));
|
||||
break;
|
||||
case 2:
|
||||
velModifier = 0.1F;
|
||||
this.motionX = (double) ((CommonProxy.rand.nextFloat() * 2.0F - 1.0F)
|
||||
* velModifier);
|
||||
this.motionY = (double) velModifier;
|
||||
this.motionZ = (double) ((CommonProxy.rand.nextFloat() * 2.0F - 1.0F)
|
||||
* velModifier);
|
||||
this.particleMaxAge = (int) (10.0D
|
||||
* ((double) world.rand.nextFloat() * 0.2D
|
||||
+ 0.8999999761581421D));
|
||||
this.particleGravity = 0.5F;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
++this.changeTime;
|
||||
if (this.changeTime > 5) {
|
||||
++this.iconIndex;
|
||||
this.changeTime = 0;
|
||||
}
|
||||
|
||||
if (this.iconIndex > 4) {
|
||||
this.iconIndex = 0;
|
||||
}
|
||||
|
||||
switch (this.type) {
|
||||
case 2:
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle(
|
||||
Tessellator tessy,
|
||||
float par2,
|
||||
float par3,
|
||||
float par4,
|
||||
float par5,
|
||||
float par6,
|
||||
float par7
|
||||
) {
|
||||
tessy.draw();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glEnable(3042);
|
||||
GL11.glBlendFunc(770, 1);
|
||||
Dartcraft.proxy.bindTexture("darticles.png");
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F);
|
||||
float var8 = (float) (this.iconIndex % 8) / 8.0F;
|
||||
float var9 = var8 + 0.124875F;
|
||||
float var10 = (float) (this.iconIndex / 8) / 8.0F;
|
||||
float var11 = var10 + 0.124875F;
|
||||
float var12 = 0.1F * this.particleScale;
|
||||
float var13 = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) par2
|
||||
- EntityFX.interpPosX);
|
||||
float var14 = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) par2
|
||||
- EntityFX.interpPosY);
|
||||
float var15 = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) par2
|
||||
- EntityFX.interpPosZ);
|
||||
tessy.startDrawingQuads();
|
||||
tessy.setBrightness(240);
|
||||
tessy.setColorRGBA_F(
|
||||
this.particleRed, this.particleGreen, this.particleBlue, 1.0F
|
||||
);
|
||||
tessy.addVertexWithUV(
|
||||
(double) (var13 - par3 * var12 - par6 * var12),
|
||||
(double) (var14 - par4 * var12),
|
||||
(double) (var15 - par5 * var12 - par7 * var12),
|
||||
(double) var9,
|
||||
(double) var11
|
||||
);
|
||||
tessy.addVertexWithUV(
|
||||
(double) (var13 - par3 * var12 + par6 * var12),
|
||||
(double) (var14 + par4 * var12),
|
||||
(double) (var15 - par5 * var12 + par7 * var12),
|
||||
(double) var9,
|
||||
(double) var10
|
||||
);
|
||||
tessy.addVertexWithUV(
|
||||
(double) (var13 + par3 * var12 + par6 * var12),
|
||||
(double) (var14 + par4 * var12),
|
||||
(double) (var15 + par5 * var12 + par7 * var12),
|
||||
(double) var8,
|
||||
(double) var10
|
||||
);
|
||||
tessy.addVertexWithUV(
|
||||
(double) (var13 + par3 * var12 - par6 * var12),
|
||||
(double) (var14 - par4 * var12),
|
||||
(double) (var15 + par5 * var12 - par7 * var12),
|
||||
(double) var8,
|
||||
(double) var11
|
||||
);
|
||||
tessy.draw();
|
||||
GL11.glDisable(3042);
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glPopMatrix();
|
||||
Dartcraft.proxy.bindTexture("textures/particle/particles.png");
|
||||
tessy.startDrawingQuads();
|
||||
}
|
||||
}
|
|
@ -5,13 +5,15 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemBlockForceBrick extends ItemBlock {
|
||||
public ItemBlockForceBrick(Block block) {
|
||||
public abstract class AbstractItemBlockMetadata extends ItemBlock {
|
||||
public AbstractItemBlockMetadata(Block block) {
|
||||
super(block);
|
||||
Util.configureItem(this, "forcebrick");
|
||||
Util.configureItem(this, this.getID());
|
||||
this.setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public abstract String getID();
|
||||
|
||||
@Override
|
||||
public int getMetadata(int damage) {
|
||||
return damage;
|
||||
|
@ -19,6 +21,6 @@ public class ItemBlockForceBrick extends ItemBlock {
|
|||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
return "tile.forcebrick" + stack.getItemDamage();
|
||||
return "tile." + this.getID() + stack.getItemDamage();
|
||||
}
|
||||
}
|
|
@ -26,17 +26,20 @@ import net.minecraftforge.client.MinecraftForgeClient;
|
|||
public class ClientProxy extends CommonProxy {
|
||||
public static RenderTileForceEngine engineRender;
|
||||
|
||||
@Override
|
||||
public boolean isSimulating(World world) {
|
||||
return world != null && !world.isRemote;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindTexture(String texture) {
|
||||
if (texture != null)
|
||||
getClientInstance().getTextureManager().bindTexture(
|
||||
this.getClientInstance().getTextureManager().bindTexture(
|
||||
new ResourceLocation(Dartcraft.MODID, texture)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
MinecraftForgeClient.registerItemRenderer(
|
||||
|
@ -77,6 +80,7 @@ public class ClientProxy extends CommonProxy {
|
|||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPacketToServer(DartPacket packet) {
|
||||
try {
|
||||
Dartcraft.channel.sendToServer(packet);
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
package ley.modding.dartcraft.tile;
|
||||
|
||||
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;
|
||||
|
||||
public class TileEntityStairs extends TileEntity {
|
||||
public int color;
|
||||
|
||||
@Override
|
||||
public boolean canUpdate() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
|
||||
this.writeToNBT(nbt);
|
||||
|
||||
return new S35PacketUpdateTileEntity(
|
||||
this.xCoord, this.yCoord, this.zCoord, this.getBlockMetadata(), nbt
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager nm, S35PacketUpdateTileEntity pkt) {
|
||||
this.readFromNBT(pkt.func_148857_g());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound comp) {
|
||||
super.readFromNBT(comp);
|
||||
if (comp.hasKey("color")) {
|
||||
this.color = comp.getInteger("color");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound comp) {
|
||||
super.writeToNBT(comp);
|
||||
comp.setInteger("color", this.color);
|
||||
}
|
||||
}
|
|
@ -104,24 +104,24 @@ public class DartUtils {
|
|||
|
||||
public static int getMcColor(int color) {
|
||||
int[] lookup = new int[] {
|
||||
0x333333,
|
||||
0xff333333,
|
||||
Color.red.getRGB(),
|
||||
Color.green.getRGB(),
|
||||
0x6e5334,
|
||||
0xff6e5334,
|
||||
Color.blue.getRGB(),
|
||||
0x6b47b8,
|
||||
0xff6b47b8,
|
||||
Color.cyan.getRGB(),
|
||||
Color.lightGray.getRGB(),
|
||||
Color.gray.getRGB(),
|
||||
Color.pink.getRGB(),
|
||||
0x9ed843,
|
||||
0xff9ed843,
|
||||
Color.yellow.getRGB(),
|
||||
0x51a8f4,
|
||||
0xff51a8f4,
|
||||
Color.magenta.getRGB(),
|
||||
Color.orange.getRGB(),
|
||||
Color.white.getRGB(),
|
||||
};
|
||||
|
||||
return color > 0 && color < lookup.length ? lookup[color] : 0;
|
||||
return color >= 0 && color < lookup.length ? lookup[color] : 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import org.lwjgl.opengl.GL11;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ley.modding.dartcraft.Dartcraft;
|
||||
import ley.modding.dartcraft.client.fx.FXDisney;
|
||||
import ley.modding.dartcraft.proxy.CommonProxy;
|
||||
import net.minecraft.client.particle.EffectRenderer;
|
||||
import net.minecraft.client.particle.EntityFireworkStarterFX;
|
||||
|
@ -386,16 +387,15 @@ public class FXUtils {
|
|||
}
|
||||
|
||||
for (int i = 0; i < num; ++i) {
|
||||
// TODO: WTF
|
||||
//FXDisney fx = new FXDisney(
|
||||
// world,
|
||||
// x + offset + world.rand.nextDouble() - world.rand.nextDouble(),
|
||||
// y + world.rand.nextDouble() - world.rand.nextDouble(),
|
||||
// z + offset + world.rand.nextDouble() - world.rand.nextDouble(),
|
||||
// color,
|
||||
// type
|
||||
//);
|
||||
//renderer.addEffect(fx);
|
||||
FXDisney fx = new FXDisney(
|
||||
world,
|
||||
x + offset + world.rand.nextDouble() - world.rand.nextDouble(),
|
||||
y + world.rand.nextDouble() - world.rand.nextDouble(),
|
||||
z + offset + world.rand.nextDouble() - world.rand.nextDouble(),
|
||||
color,
|
||||
type
|
||||
);
|
||||
renderer.addEffect(fx);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
|
@ -20,6 +20,7 @@ tile.forceleaves.name=Force Leaves
|
|||
tile.forcesapling.name=Force Sapling
|
||||
tile.forcepickaxe.name=Force Pickaxe
|
||||
|
||||
tile.forceplanks.name=Force Planks
|
||||
tile.forcebrick0.name=Black Force Brick
|
||||
tile.forcebrick1.name=Red Force Brick
|
||||
tile.forcebrick2.name=Green Force Brick
|
||||
|
@ -36,5 +37,22 @@ tile.forcebrick12.name=Light Blue Force Brick
|
|||
tile.forcebrick13.name=Magenta Force Brick
|
||||
tile.forcebrick14.name=Orange Force Brick
|
||||
tile.forcebrick15.name=White Force Brick
|
||||
tile.forceslab0.name=Black Force Slab
|
||||
tile.forceslab1.name=Red Force Slab
|
||||
tile.forceslab2.name=Green Force Slab
|
||||
tile.forceslab3.name=Brown Force Slab
|
||||
tile.forceslab4.name=Blue Force Slab
|
||||
tile.forceslab5.name=Purple Force Slab
|
||||
tile.forceslab6.name=Cyan Force Slab
|
||||
tile.forceslab7.name=Light Gray Force Slab
|
||||
tile.forceslab8.name=Gray Force Slab
|
||||
tile.forceslab9.name=Pink Force Slab
|
||||
tile.forceslab10.name=Lime Force Slab
|
||||
tile.forceslab11.name=Yellow Force Slab
|
||||
tile.forceslab12.name=Light Blue Force Slab
|
||||
tile.forceslab13.name=Magenta Force Slab
|
||||
tile.forceslab14.name=Orange Force Slab
|
||||
tile.forceslab15.name=White Force Slab
|
||||
tile.forceslab16.name=Wooden Force Slab
|
||||
|
||||
itemGroup.dartcraft=Dartcraft
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 3.0 KiB |
Loading…
Reference in New Issue