How To Make Custom Texture System For A Block In Minecraft

Apr 20, 2014

I am trying to make a custom texture system for a block in Minecraft, I am not too advanced with Java and am not sure how to make this work the way I want it to.

/** The list of the types of step blocks. */
public static final String[] blockStepTypes = new String[] {"stone", "sand", "wood", "cobble", "brick", "smoothStoneBrick", "netherBrick", "quartz"};
  private Icon missing;
private Icon icon1;
 
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
*/

[Code] .....

Alright, so basically I figured I could just tell the code to see if the block is made out of Stone, then to set the texture to Stone, or if it's made out of Sand, then set it to Sand.

What I usually get is Eclipse telling me to "insert '!= null' check", "insert '!= null' check", and then just error out saying "Opperator != is undefined for the argument type(s) boolean null"

Is there any way I could make this work for me? Maybe some other way to make it do what I am trying to do?

View Replies


ADVERTISEMENT

LWJGL - Minecraft Clone / Drawing Just ONE Simple Dirt Block

Feb 21, 2015

I am currently working on a Minecraft clone (called "Build"), and I'm trying draw just ONE simple dirt block, but it will only draw a square!

Here is the main class:

package game;
 import game.block.DirtBlock;
 import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import org.lwjgl.opengl.GL11;
 
[Code] ....

And the Block class ( the one that all Block Types are based off of):

package game;
 import static org.lwjgl.opengl.GL11.*;
 import java.io.IOException;
import java.nio.FloatBuffer;
 import org.lwjgl.opengl.GL11;
import org.newdawn.slick.opengl.Texture;
import org.newdawn.slick.opengl.TextureLoader;
import org.newdawn.slick.util.ResourceLoader;
 
[Code] ....

And that is the code, I'll make updates as needed.

View Replies View Related

How To Make Own Powerball Input System

Dec 5, 2014

Below is all the coding I have done trying to make my own Powerball input system. I am really struggling on how to fix this. I keep getting an ArrayOutOfBounds exception except, I don't know how to fix this to make it where it will check the numbers without screwing up with everything.

Java Code:

import java.util.Scanner;
public class PowerballTest
{
Scanner input = new Scanner(System.in);
public static void main(String[] args)
{
Powerball.readInput();
Powerball.writeOutput();

[Code] ....

This is the problem i keep seeing when the test run happens :

Enter the first Powerball number which should be greater than 0 and less than 60
2
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5
at Powerball.checkNumber(Powerball.java:73)
at Powerball.readInput(Powerball.java:23)
at PowerballTest.main(PowerballTest.java:9)

(Don't know if should have formatted that^)

View Replies View Related

How To Make The Program Understand 10 Number System

Oct 24, 2014

I want to create a program where i can output a number. ex. 3452 And the program will output 3000: three thousand 5: five 53: fifty-three

How can i make the program understand the 10-number system?

View Replies View Related

How To Make A Model Of Solar System - Have Sun And Earth Revolving Around It

Oct 25, 2014

I'm attempting to make a model of the solar system. Up till now, I have a Sun and the Earth revolving around it. The problem I have is when I add inheritance to the program. The moon that I created does not orbit the Earth.

Here's my code for the classes I've created

public class Driver {
public static void main(String[] args){
SolarSystem model = new SolarSystem(700, 700);
/* Create new instances of each object in the solar system */
SunObject sun = new SunObject();
PlanetObject earth = new PlanetObject(140, 30, 15, "BLUE", 2);
MoonObject moon = new MoonObject(15, 30, 2, "WHITE", 1.5);

[Code] ....

Note that SolarSystem is a class given to me. That contains all the paint methods. I'm just creating new instances with the drawSolarObject()

And the drawSolarObjectAbout takes an extra two parameters:

centreOfRotationDistance - the distance part of the polar co-ordinate about which this object orbits.
centreOfRotationAngle - the angular part of the polar co-ordinate about which this object orbits

I have a PlanetObject class:

public class PlanetObject extends PointInSpace {
private double distance;
private double angle;
private double diameter;
private String colour;
private double speed;

[Code] ....

And a MoonObject class, which is EXACTLY the same as the PlanetObject class. The main problem I'm having is when I extend my PlanetObject class to a PointInSpace class below:

public class PointInSpace {
private double distance;
private double angle;
public double getPointDistance(){
return distance;

[Code] .....

What I'm trying to do is use the distance and angle in the PointInSpace class so that my Moon can orbit those two coordinates . I get it working when I method override when drawing the moon - using earth.getDistance() instead of earth.getPointDistance() etc. Have I inherited properly? Should I try a method overloading process instead?

View Replies View Related

2D Circle Texture Rotation?

Jan 11, 2015

So I have this randomly generated set of tiles that is wrapped in a circle and I'm not really sure how to scroll it around the circle. Basically it's a side-view planet that is in 2D and needs to be wrapped and moving at a controllable rate to give the illusion of planet rotation. What to do to the x and y to make it scroll around. I want every tile except the water tiles to move from left to right and then wrap around the circle. Here's what a planet looks like: [URL] ....

Java Code:

for (int x = 0; x < planet1.length; x++)
{
for (int y = 0; y < planet1[0].length; y++)
{
if (planet1[x][y] == 1 || planet1[x][y] == 2)
{
g.drawImage(water, x * 32, y * 32);

[Code] ....

View Replies View Related

Minecraft Factions Server Error

May 29, 2014

This appears in my console when I run the server.

29.05 00:57:55 [Server] INFO Caused by: java.lang.NoClassDefFoundError: com/massivecraft/mcore/util/SenderUtil

What can I do to fix it?

View Replies View Related

Storing Custom Object In SQLite DB / Serializing Custom Object?

Jul 13, 2014

I have this arraylist off a custom object that looks like this witch also contains a list off custom objects

package holders;
import java.util.ArrayList;
public class ManufacturingJobHolder {
private String name;

[code]....

View Replies View Related

Block Division In Cryptography

Feb 20, 2014

I have used FileInputStream class but its not working properly to divide the bits into blocks.I will attach the coding

public static void main(String[] args) {
 ReadFileExample newclass = new ReadFileExample();
System.out.println("cryptography");

[Code].....

View Replies View Related

InputMismatchException In Catch Block

Sep 19, 2014

In the following piece of code Iam confused as to where the InputMismatchException in the catch block is thrown on the first place? Is the InputMismatchException thrown automatically with declaring to throw the exception?

import java.util.*;

public class InputMismatchExceptionDemo {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
boolean continueInput = true;

[code]....

View Replies View Related

Java Try Catch Block

Apr 13, 2015

Is it a best practice to return from try block or place return statement after try-catch when we intend to return a value from a method(* Catch block is being also used to rethrow the exception)??

View Replies View Related

Java Coding For Block Division

Feb 7, 2014

I'm doing project in area of "Cryptography and Network security". I'm having a file with binary Unicode (mean file contain Unicode value of corresponding data (text file)), want to divide that as blocks with the size of 144bits.

View Replies View Related

Returning In Methods With Try Catch Block

Feb 18, 2015

Regarding return statements within methods. So I have a method containing try and catch block (as required) and much like when you have an if else statement... I noted you have to return an object for both the try and catch blocks. Now in my case my method should return a List object.

The way I have tried to overcome this:

- I've initialised a List object to null as an attribute of the class I'm working in.
- Therefore in the catch block would just simply return the null List object, where as the try block would return the non-empty List (which is what I want).
- I then just test to see if the List != null, when the method is invoked... and that is that.

However the method always seems to return null (when it shouldn't).

View Replies View Related

Have Block Letters Come Out Horizontally Instead Of Vertical

Sep 2, 2014

I can make my program print block letters out in a vertical format but I need them to come out in a horizontal format.

public class MISSISSIPPI {
public static void main(String[] args) {
drawM(); drawI(); drawS(); drawS(); drawI(); drawS(); drawS(); drawI(); drawP(); drawP(); drawI();
}

How would I get those methods to come out in a horizontal fashion instead of vertical?

View Replies View Related

Sync Block In Java - Servlet

Dec 23, 2014

Modify the program in Assign4 to synchronize access to the instance variable, balance. Save the program as SyncBank.java. Because balance is a double and not an object, it cannot be used as the monitor. Use synchronized methods or synchronized blocks of code as appropriate. Simultaneously test two threads as was done in Assign4. Because the threads can complete too quickly to determine if they are interfering with each other, delay the adding of a deposit by inserting the following code within the synchronized block or method:

try {
Thread.currentThread().sleep(10000); //sleep for milliseconds
}
catch(InterruptedException e) {
}

My code attempt so far:

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import java.net.*;
import java.text.DecimalFormat;
public class SyncBank extends HttpServlet //throws ServletException, IOException

[Code] .....

View Replies View Related

Passing ResultSet But Within Try / Finally Block

Jul 7, 2014

It's always good to keep functions smaller and focused on one behavior. So is this safe:

Java Code:

public Unit findBySql(int id){
Unit unit=null;
DbConnectionPool dbPool = DbConnectionPool.getInstance();
HashMap<String, String> conditions = new HashMap<String, String>();
conditions.put("id", String.valueOf(id));
String sql = buildSelect("units", "*", conditions);

[Code] ......

As you can see a pass ResultSet to a function which populates the item. But I also make sure that the ResultSet that the passed object is pointing to is closed, so it doesn't leak resources.

View Replies View Related

Static Block In Java Executes First

Mar 21, 2014

why Static Block in java executes first than the main block?

what is specific reason??

View Replies View Related

Unread Block Data When ReadObject

May 1, 2014

I am developing a Client/Server java application, where CSMessage is sent through socket.CSMessage has some data like String type and HashMap<String, String> type.the Client send message:

private ObjectInputStream in;
private ObjectOutputStream out;
out = new ObjectOutputStream(socket.getOutputStream());
in = new ObjectInputStream(socket.getInputStream());

[code]....

When this happen, the only way to make the system to work is to kill the process and restart it, that's bad!

View Replies View Related

Deleting A Block Of Items From ArrayList

Jan 7, 2015

My current lesson in Java is about ArrayLists and I'm having a tough time to understand this bit of code: This exercise is concerned with the problem of deleting a block of items from an ArrayList.

public static void deleteBlock( ArrayList<String> strings, int n )
{
for ( int i = 0; i < n; i++ )
{
if ( strings.size() > 0 )
strings.remove( i );

[Code] ....

This is the output: [rosion, sion, on, n]

View Replies View Related

Pass Parameter Between Try / Catch Block

Oct 14, 2014

Any way to pass parameter between try/catch block.

In other word:

I have a method:
 
public void invia(OiStorto invioaca) throws Exception {
         Long id=0L;
        try {
               //some code
     for (VElenpere elenpere : elenperes) {
                popolaScompiute(anno, inviaEOI0, param, opempiute, elenpere,id);

[Code] ....
   
And finally the method in which the error can occur (the method poputa is called for every id)
 
private void poputa(ElOpeIncType opereIncompiute, OpeIncType operaSingola, OiOpera opere) {
try {
//some code
} catch (NullPointerException e) {
            e.printStackTrace();
            //return id;
        }

So method invia call the method popolaScompiute, inside popolaScompiute there is an iteraction through some id and for some id can occur an error; what i want is the getting the value of id in the first method invia, using the block try/catch. Is there a way to accomplish this?

View Replies View Related

How Does Return Statement Work In Try Catch Block

Jul 2, 2014

consider this program :

public class hello {
/**
* @param args
*/
public static void main(String[] args) {
int s = new hello().h();
System.out.println(s);
} public int h(){
try{
int g = 10/0;

[Code] .....

the output is 7. how the flow is working. i understand that there is a divide by zero exception after which the control goes to catch. what about the return statement in catch . why is it overridden by finally..........

View Replies View Related

Throwing Exception From Catch And Finally Block

Jul 16, 2014

I came across a code where the exceptions can be thrown from catch and finally block too. I never gave a thought on what scenarios that can be required. Some practical examples when/where it can be required to throw the exception from catch and finally blocks.

View Replies View Related

Java Block Breaking Game - GUI Is Not Displaying

Dec 7, 2014

I get no errors but the gui is not displaying

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package part1;
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import javax.swing.*;
class brick {

[Code] ....

View Replies View Related

Catch Block Error Variable Might Not Have Been Initialized

Feb 28, 2015

I want to use a try catch block, but I am not sure how to fix this problem:

int a;

try{
a = Integer.parseInt(A.getText());
}
catch (Exception e){
Output1.setText("Error");
}

//do someting with a here

The purpose of the try-catch is to catch blank input.The problem with this is that underneath the try - catch I get an error saying that the variable might not have been initialized. I know why this happens. I know I could initialize the varaible before the try - catch, but there is no default or null I can set an int as. If I initialized it as 0, the blank input will no longer be catched.how to make this problem disappear?

View Replies View Related

Simple Pong Game - Touch Red Block

Dec 27, 2014

I don't know how to write a code to pong ball, when it touch red block.

public class bounc2 extends JPanel implements ActionListener,KeyListener{
double x = 0,y=0,velX=3,velY=3;
double x2 = 5,y2=145,velX2=0,velY2=0;
double x3= 473,y3=145,velX3=0,velY3=0;
Timer t = new Timer(5,this);
public bounc2(){
setBackground(Color.GREEN);

[Code] .....

View Replies View Related

Exception Handling - Block Cannot Modify Primitive Values

Sep 23, 2014

class MultipleReturn {
int getInt() {
int returnVal = 10;
try {
String[] students = {"Harry", "Paul"};
//System.out.println(students[5]); //if i remove comment

[Code] .....

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved