fix: Particles
This commit is contained in:
parent
034d0e5852
commit
e84e9c0b53
|
@ -0,0 +1,59 @@
|
|||
package ley.modding.dartcraft.block;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ley.modding.dartcraft.util.FXUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.particle.EffectRenderer;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BaseBlock extends Block {
|
||||
public static final int DEFAULT_COLOR = Color.yellow.getRGB();
|
||||
|
||||
protected BaseBlock(Material arg0) {
|
||||
super(arg0);
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return DEFAULT_COLOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean addDestroyEffects(
|
||||
World world, int x, int y, int z, int meta, EffectRenderer renderer
|
||||
) {
|
||||
FXUtils.makeShiny(
|
||||
world,
|
||||
(double) x,
|
||||
(double) y,
|
||||
(double) z,
|
||||
2,
|
||||
this.getColor(),
|
||||
32,
|
||||
true
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean
|
||||
addHitEffects(World world, MovingObjectPosition target, EffectRenderer renderer) {
|
||||
FXUtils.makeShiny(
|
||||
world,
|
||||
(double) target.blockX,
|
||||
(double) target.blockY,
|
||||
(double) target.blockZ,
|
||||
2,
|
||||
this.getColor(),
|
||||
4,
|
||||
true
|
||||
);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,32 +1,22 @@
|
|||
package ley.modding.dartcraft.block;
|
||||
|
||||
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.item.AbstractItemBlockMetadata;
|
||||
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 net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.particle.EffectRenderer;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EnumCreatureType;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockForceBrick extends Block {
|
||||
public class BlockForceBrick extends BaseBlock {
|
||||
int type;
|
||||
|
||||
public BlockForceBrick(int type) {
|
||||
|
@ -82,38 +72,8 @@ public class BlockForceBrick extends Block {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean addDestroyEffects(
|
||||
World world, int x, int y, int z, int meta, EffectRenderer renderer
|
||||
) {
|
||||
FXUtils.makeShiny(
|
||||
world,
|
||||
(double) x,
|
||||
(double) y,
|
||||
(double) z,
|
||||
2,
|
||||
DartUtils.getMcColor(this.type),
|
||||
32,
|
||||
true
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean
|
||||
addHitEffects(World world, MovingObjectPosition target, EffectRenderer renderer) {
|
||||
FXUtils.makeShiny(
|
||||
world,
|
||||
(double) target.blockX,
|
||||
(double) target.blockY,
|
||||
(double) target.blockZ,
|
||||
2,
|
||||
DartUtils.getMcColor(this.type),
|
||||
4,
|
||||
true
|
||||
);
|
||||
return true;
|
||||
public int getColor() {
|
||||
return DartUtils.getMcColor(this.type);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,6 +5,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
import ley.modding.dartcraft.Dartcraft;
|
||||
import ley.modding.dartcraft.tile.TileEntityForceEngine;
|
||||
import ley.modding.dartcraft.util.DartUtils;
|
||||
import ley.modding.dartcraft.util.FXUtils;
|
||||
import ley.modding.tileralib.api.ITEProvider;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
|
@ -131,22 +132,38 @@ public class BlockForceEngine extends BlockContainer implements ITEProvider {
|
|||
: false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean addDestroyEffects(
|
||||
World world, int x, int y, int z, int meta, EffectRenderer renderer
|
||||
) {
|
||||
//FXUtils.makeShiny(world, (double)x, (double)y, (double)z, 2, 16776960, 16,
|
||||
//true);
|
||||
FXUtils.makeShiny(
|
||||
world,
|
||||
(double) x,
|
||||
(double) y,
|
||||
(double) z,
|
||||
2,
|
||||
BaseBlock.DEFAULT_COLOR,
|
||||
32,
|
||||
true
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean
|
||||
addHitEffects(World world, MovingObjectPosition target, EffectRenderer renderer) {
|
||||
if (world != null && target != null) { //TODO FX
|
||||
//FXUtils.makeShiny(world, (double)target.blockX, (double)target.blockY,
|
||||
//(double)target.blockZ, 2, 16776960, 3, true);
|
||||
}
|
||||
FXUtils.makeShiny(
|
||||
world,
|
||||
(double) target.blockX,
|
||||
(double) target.blockY,
|
||||
(double) target.blockZ,
|
||||
2,
|
||||
BaseBlock.DEFAULT_COLOR,
|
||||
4,
|
||||
true
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,16 +1,20 @@
|
|||
package ley.modding.dartcraft.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ley.modding.dartcraft.Dartcraft;
|
||||
import ley.modding.dartcraft.util.FXUtils;
|
||||
import ley.modding.dartcraft.util.Util;
|
||||
import net.minecraft.block.BlockLeaves;
|
||||
import net.minecraft.client.particle.EffectRenderer;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import java.util.Random;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockForceLeaves extends BlockLeaves {
|
||||
private IIcon icon;
|
||||
|
@ -78,4 +82,39 @@ public class BlockForceLeaves extends BlockLeaves {
|
|||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
|
||||
return Item.getItemFromBlock(DartBlocks.forcesapling);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean addDestroyEffects(
|
||||
World world, int x, int y, int z, int meta, EffectRenderer renderer
|
||||
) {
|
||||
FXUtils.makeShiny(
|
||||
world,
|
||||
(double) x,
|
||||
(double) y,
|
||||
(double) z,
|
||||
2,
|
||||
BaseBlock.DEFAULT_COLOR,
|
||||
32,
|
||||
true
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean
|
||||
addHitEffects(World world, MovingObjectPosition target, EffectRenderer renderer) {
|
||||
FXUtils.makeShiny(
|
||||
world,
|
||||
(double) target.blockX,
|
||||
(double) target.blockY,
|
||||
(double) target.blockZ,
|
||||
2,
|
||||
BaseBlock.DEFAULT_COLOR,
|
||||
4,
|
||||
true
|
||||
);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
package ley.modding.dartcraft.block;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ley.modding.dartcraft.Dartcraft;
|
||||
import ley.modding.dartcraft.util.FXUtils;
|
||||
import ley.modding.dartcraft.util.Util;
|
||||
import net.minecraft.block.BlockLog;
|
||||
import net.minecraft.client.particle.EffectRenderer;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockForceLog extends BlockLog {
|
||||
private IIcon sideIcon;
|
||||
|
@ -45,4 +51,39 @@ public class BlockForceLog extends BlockLog {
|
|||
public boolean isWood(IBlockAccess arg0, int arg1, int arg2, int arg3) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean addDestroyEffects(
|
||||
World world, int x, int y, int z, int meta, EffectRenderer renderer
|
||||
) {
|
||||
FXUtils.makeShiny(
|
||||
world,
|
||||
(double) x,
|
||||
(double) y,
|
||||
(double) z,
|
||||
2,
|
||||
BaseBlock.DEFAULT_COLOR,
|
||||
32,
|
||||
true
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean
|
||||
addHitEffects(World world, MovingObjectPosition target, EffectRenderer renderer) {
|
||||
FXUtils.makeShiny(
|
||||
world,
|
||||
(double) target.blockX,
|
||||
(double) target.blockY,
|
||||
(double) target.blockZ,
|
||||
2,
|
||||
BaseBlock.DEFAULT_COLOR,
|
||||
4,
|
||||
true
|
||||
);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
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 class BlockForcePlanks extends BaseBlock {
|
||||
public BlockForcePlanks() {
|
||||
super(Material.wood);
|
||||
Util.configureBlock(this, "forceplanks");
|
||||
|
|
|
@ -1,21 +1,26 @@
|
|||
package ley.modding.dartcraft.block;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ley.modding.dartcraft.Dartcraft;
|
||||
import ley.modding.dartcraft.util.FXUtils;
|
||||
import ley.modding.dartcraft.util.Util;
|
||||
import ley.modding.dartcraft.worldgen.GenForceTree;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockSapling;
|
||||
import net.minecraft.client.particle.EffectRenderer;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.terraingen.TerrainGen;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockForceSapling extends BlockSapling {
|
||||
IIcon icon;
|
||||
|
||||
|
@ -48,4 +53,39 @@ public class BlockForceSapling extends BlockSapling {
|
|||
public IIcon getIcon(int p_149691_1_, int p_149691_2_) {
|
||||
return this.icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean addDestroyEffects(
|
||||
World world, int x, int y, int z, int meta, EffectRenderer renderer
|
||||
) {
|
||||
FXUtils.makeShiny(
|
||||
world,
|
||||
(double) x,
|
||||
(double) y,
|
||||
(double) z,
|
||||
2,
|
||||
BaseBlock.DEFAULT_COLOR,
|
||||
32,
|
||||
true
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean
|
||||
addHitEffects(World world, MovingObjectPosition target, EffectRenderer renderer) {
|
||||
FXUtils.makeShiny(
|
||||
world,
|
||||
(double) target.blockX,
|
||||
(double) target.blockY,
|
||||
(double) target.blockZ,
|
||||
2,
|
||||
BaseBlock.DEFAULT_COLOR,
|
||||
4,
|
||||
true
|
||||
);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,30 +1,35 @@
|
|||
package ley.modding.dartcraft.block;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import ley.modding.dartcraft.Config;
|
||||
import ley.modding.dartcraft.Dartcraft;
|
||||
import ley.modding.dartcraft.item.AbstractItemBlockMetadata;
|
||||
import ley.modding.dartcraft.item.DartItems;
|
||||
import ley.modding.dartcraft.util.Util;
|
||||
import ley.modding.tileralib.api.ICustomItemBlockProvider;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.item.EntityXPOrb;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
public class BlockPowerOre extends BaseBlock implements ICustomItemBlockProvider {
|
||||
public static final String ID = "powerore";
|
||||
|
||||
public class BlockPowerOre extends Block {
|
||||
public static IIcon stoneicon;
|
||||
public static IIcon nethericon;
|
||||
public static IIcon powericon;
|
||||
|
||||
public BlockPowerOre() {
|
||||
super(Material.rock);
|
||||
Util.configureBlock(this, "powerore");
|
||||
Util.configureBlock(this, ID);
|
||||
setHardness(3.0F);
|
||||
setResistance(10.0F);
|
||||
setStepSound(soundTypeStone);
|
||||
|
@ -43,16 +48,14 @@ public class BlockPowerOre extends Block {
|
|||
@Override
|
||||
public void registerBlockIcons(IIconRegister reg) {
|
||||
powericon = reg.registerIcon(Dartcraft.MODID + ":powerore");
|
||||
stoneicon = reg.registerIcon("stone");
|
||||
nethericon = reg.registerIcon("netherrack");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
if (meta == 1) {
|
||||
return nethericon;
|
||||
return Blocks.netherrack.getIcon(0, 0);
|
||||
}
|
||||
return stoneicon;
|
||||
return Blocks.stone.getIcon(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -75,13 +78,31 @@ public class BlockPowerOre extends Block {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
list.add(new ItemStack(this, 1, 0));
|
||||
list.add(new ItemStack(this, 1, 1));
|
||||
IntStream.rangeClosed(0, 1)
|
||||
.mapToObj(m -> new ItemStack(this, 1, m))
|
||||
.forEach(list::add);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canSilkHarvest() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@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 ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import ley.modding.dartcraft.block.BlockPowerOre;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
@ -18,9 +19,9 @@ public class PowerOreRenderer
|
|||
renderer.setRenderBoundsFromBlock(block);
|
||||
IIcon bgIcon = null;
|
||||
if (meta == 1) {
|
||||
bgIcon = BlockPowerOre.nethericon;
|
||||
bgIcon = Blocks.netherrack.getIcon(0, 0);
|
||||
} else {
|
||||
bgIcon = BlockPowerOre.stoneicon;
|
||||
bgIcon = Blocks.stone.getIcon(0, 0);
|
||||
}
|
||||
DrawFaces(renderer, block, bgIcon, false);
|
||||
GL11.glColor3f(1.0F, 1.0F, 0.0F);
|
||||
|
@ -38,7 +39,7 @@ public class PowerOreRenderer
|
|||
int modelId,
|
||||
RenderBlocks renderer
|
||||
) {
|
||||
int brightness = setBrightness(world, x, y, z, block);
|
||||
BlockRenderer.setBrightness(world, x, y, z, block);
|
||||
block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
|
|
|
@ -14,7 +14,8 @@ item.forceflask_potion_green.name=Green Liquid Flask
|
|||
item.forceflask_potion_blue.name=Blue Liquid Flask
|
||||
item.forceflask_potion_red.name=Red Liquid Flask
|
||||
item.clipboard.name=Clipboard
|
||||
tile.powerore.name=Power Ore
|
||||
tile.powerore0.name=Power Ore
|
||||
tile.powerore1.name=Nether Power Ore
|
||||
tile.forcelog.name=Force Log
|
||||
tile.forceleaves.name=Force Leaves
|
||||
tile.forcesapling.name=Force Sapling
|
||||
|
|
Loading…
Reference in New Issue