Skip to content

Instantly share code, notes, and snippets.

@ft975
ft975 / EntityDiggingParticle.java
Last active December 19, 2015 10:19
Making particles for a block come from the getTexture instead of getIcon
@SideOnly(Side.CLIENT)
class EntityDiggingParticle extends EntityFX {
public EntityDiggingParticle(wrd: World, pos1X: Double, pos1Y: Double, pos1Z: Double, motX: Double, motY: Double, motZ: Double, icon: Icon){
super(wrd, pos1X, pos1Y, pos1Z, motX, motY, motZ);
particleIcon = icon
particleGravity = 1
particleScale /= 2.0F
}
2013-07-05 23:55:45 [SEVERE] [Minecraft-Client] ########## GL ERROR ##########
2013-07-05 23:55:45 [SEVERE] [Minecraft-Client] @ Post render
2013-07-05 23:55:45 [SEVERE] [Minecraft-Client] 1283: Stack overflow
2013-07-05 23:55:45 [INFO] [ForgeModLoader] Desperation! I'm getting called to render a capsule!
2013-07-05 23:55:45 [INFO] [ForgeModLoader] Desperation! I'm getting called to render a capsule!
2013-07-05 23:55:45 [INFO] [ForgeModLoader] Desperation! I'm getting called to render a capsule!
2013-07-05 23:55:45 [INFO] [ForgeModLoader] Desperation! I'm getting called to render a capsule!
2013-07-05 23:55:45 [INFO] [ForgeModLoader] Desperation! I'm getting called to render a capsule!
2013-07-05 23:55:45 [INFO] [ForgeModLoader] Desperation! I'm getting called to render a capsule!
2013-07-05 23:55:45 [INFO] [ForgeModLoader] Desperation! I'm getting called to render a capsule!
Caused by: java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2219)
at java.util.PriorityQueue.grow(PriorityQueue.java:285)
at java.util.PriorityQueue.offer(PriorityQueue.java:324)
at java.util.PriorityQueue.add(PriorityQueue.java:306)
at YATS.util.TubeRouting.ScanBlock(TubeRouting.java:37)
at YATS.util.TubeRouting.FindRoute(TubeRouting.java:80)
at YATS.tile.TileTube.updateEntity(TileTube.java:143)
at net.minecraft.world.World.updateEntities(World.java:2202)
at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:546)
@ft975
ft975 / Example.java
Created July 4, 2013 20:29
Example MachineSide
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.ForgeDirection;
public class Example extends Block {
public Example(int par1, Material par2Material) {
super(par1, par2Material);
}
def operateOnSurroundings(op: (Int, Int, Int) => Unit, x: Int, y: Int, z: Int) {
op(x, y, z)
op(x + 1, y, z)
op(x - 1, y, z)
op(x, y + 1, z)
op(x, y - 1, z)
op(x, y, z + 1)
op(x, y, z - 1)
}
@ft975
ft975 / MyBlock.java
Last active December 19, 2015 06:19
How to use alpha blending with TESRs
public class MyBlock extends BlockContainer{
@Override
public TileEntity createNewTileEntity(World wrd) {return new MyTileEntity();}
@SideOnly(Side.CLIENT)
@Override
public int getRenderBlockPass { return 1; }
@SideOnly(Side.CLIENT)
import java.awt.image.BufferedImage
import java.io.File
import javax.imageio.ImageIO
object MakeScrolling {
val intArray = new Array[Int](1)
// Usage MakeScrolling InputFile OutputFile
def main(args: Array[String]) {
val dskImg: BufferedImage = ImageIO.read(new File(args(0)))
GIMP Gradient
Name: Plasma
4
0.000000 0.000000 0.273224 0.611765 0.356863 0.666667 1.000000 0.641176 0.333333 0.635294 1.000000 0 0 0 0
0.273224 0.393443 0.469945 0.641176 0.333333 0.635294 1.000000 0.562239 0.301924 0.599752 1.000000 0 0 0 0
0.469945 0.677596 0.868852 0.562239 0.301924 0.599752 1.000000 0.454898 0.186852 0.422862 1.000000 2 0 0 0
0.868852 0.945355 1.000000 0.454898 0.186852 0.422862 1.000000 0.419608 0.149020 0.364706 1.000000 2 0 0 0
-----------------------
CSS
@override public Packet getDescriptionPacket() {
final NBTTagCompound tc = new NBTTagCompound(); // Make a new TagCompound to store the data in
super.writeToNBT(tc); // Tell the superclass TE to fill the tag compound with data
this.writeToNBT(tc); // Tell the current TE to fill the tag compound with data
return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, 2, tc); // Make a new packet with the information Par1 = xPosition, par2 = yPosition, par3 = zPosition, par4 = ???, par5 = tag compound we just filled with information
}
@override public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt) {
super.onDataPacket(net, pkt); // Do things like postion and anything else minecraft wants to do
readFromNBT(pkt.customParam1); // Read the packet ourselves and get inforation stored in the tag compound
def setupBlocks() {
blockLamp = new BlockLamp(blockID)
blockLamp.setLightOpacity(0)
GameRegistry.registerBlock(blockLamp, classOf[ItemLamp], "BlockLamp", ModInfo.modID)
blockLamp.setCreativeTab(CreativeTabs.tabBlock)
for (col: Colors <- Colors.vals;
sha: Shapes <- Shapes.vals) {
val iS = ItemLamp.buildStack(1, col, sha, true)
LanguageRegistry.addName(iS, col.name + " " + sha.name)
DebugOnly {