Skip to content

Commit 368945c

Browse files
committed
1.9 is functional \o/ (apart from blocks still rendering wrong in the inventore)
1 parent 19d8e0c commit 368945c

File tree

23 files changed

+80
-205
lines changed

23 files changed

+80
-205
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package at.chaosfield.openradio.block;
2+
3+
import net.minecraft.block.Block;
4+
import net.minecraft.item.ItemBlock;
5+
import net.minecraft.item.ItemStack;
6+
7+
/**
8+
* Created by XDjackieXD
9+
*/
10+
public class BaseItemBlock extends ItemBlock{
11+
public BaseItemBlock(Block block){
12+
super(block);
13+
this.setHasSubtypes(false);
14+
this.setMaxDamage(0);
15+
}
16+
17+
@Override
18+
public String getUnlocalizedName(ItemStack stack){
19+
return this.getUnlocalizedName();
20+
}
21+
22+
@Override
23+
public int getMetadata(int meta){
24+
return meta;
25+
}
26+
}

src/main/java/at/chaosfield/openradio/entity/LaserEntity.java

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
package at.chaosfield.openradio.entity;
22

33
import at.chaosfield.openradio.OpenRadio;
4+
import at.chaosfield.openradio.block.LaserBlock;
5+
import at.chaosfield.openradio.interfaces.ILaserModifier;
46
import at.chaosfield.openradio.render.LaserParticle;
7+
import at.chaosfield.openradio.tileentity.LaserTileEntity;
58
import at.chaosfield.openradio.util.Location;
9+
import net.minecraft.init.Blocks;
610
import net.minecraft.server.MinecraftServer;
11+
import net.minecraft.tileentity.TileEntity;
712
import net.minecraft.util.math.MathHelper;
13+
import net.minecraft.util.math.RayTraceResult;
814
import net.minecraft.util.math.Vec3d;
915
import net.minecraft.world.WorldServer;
1016
import net.minecraftforge.fml.relauncher.Side;
@@ -198,19 +204,19 @@ public void onEntityUpdate() {
198204
}
199205
}
200206

201-
/*Vec3d posVec = new Vec3d(this.posX, this.posY, this.posZ);
207+
Vec3d posVec = new Vec3d(this.posX, this.posY, this.posZ);
202208
Vec3d nextPosVec = new Vec3d(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
203-
MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks(posVec, nextPosVec);
209+
RayTraceResult movingobjectposition = this.worldObj.rayTraceBlocks(posVec, nextPosVec);
204210

205211

206212
if(movingobjectposition != null){
207-
if(movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
208-
if(this.worldObj.getBlockState(movingobjectposition.getBlockPos()).getBlock() == Blocks.portal){
213+
if(movingobjectposition.typeOfHit == RayTraceResult.Type.BLOCK)
214+
if(this.worldObj.getBlockState(movingobjectposition.getBlockPos()).getBlock() == Blocks.PORTAL){
209215
this.setPortal(this.getPosition());
210-
}else if(this.worldObj.getBlockState(movingobjectposition.getBlockPos()).getBlock().getMaterial().isOpaque()){ //only collide with non-transparent blocks
216+
}else if(this.worldObj.getBlockState(movingobjectposition.getBlockPos()).getBlock().getMaterial(this.worldObj.getBlockState(movingobjectposition.getBlockPos())).isOpaque()){ //only collide with non-transparent blocks
211217
this.onImpact(movingobjectposition);
212218
}
213-
}*/
219+
}
214220

215221
this.posX += this.motionX;
216222
this.posY += this.motionY;
@@ -271,22 +277,21 @@ public boolean writeToNBTOptional(NBTTagCompound nbtTagCompound){
271277
return false;
272278
}
273279

274-
//TODO fix impact
275-
/*protected void onImpact(MovingObjectPosition mop){
280+
protected void onImpact(RayTraceResult mop){
276281
TileEntity senderLaserTe = null;
277282
if(!worldObj.isRemote){
278283
senderLaserTe = DimensionManager.getWorld(senderLaser.getDim()).getTileEntity(senderLaser.getPos());
279284
}
280285

281-
if(mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK){
286+
if(mop.typeOfHit == RayTraceResult.Type.BLOCK){
282287
Block hitBlock = this.worldObj.getBlockState(mop.getBlockPos()).getBlock();
283288

284289
if(hitBlock instanceof LaserBlock && senderLaserTe instanceof LaserTileEntity){
285290

286291
TileEntity te = this.worldObj.getTileEntity(mop.getBlockPos());
287292
if(te instanceof LaserTileEntity){
288293
if(mop.sideHit.getIndex() == te.getBlockMetadata())
289-
((LaserTileEntity) senderLaserTe).setDestination(this.worldObj.provider.getDimensionId(), mop.getBlockPos(), this.distance);
294+
((LaserTileEntity) senderLaserTe).setDestination(this.worldObj.provider.getDimension(), mop.getBlockPos(), this.distance);
290295
else
291296
((LaserTileEntity) senderLaserTe).disconnect();
292297
}else
@@ -310,7 +315,7 @@ public boolean writeToNBTOptional(NBTTagCompound nbtTagCompound){
310315
if(senderLaserTe instanceof LaserTileEntity)
311316
((LaserTileEntity) senderLaserTe).disconnect();
312317
}
313-
}*/
318+
}
314319

315320
public double getMultiplier(){
316321
return multiplier;

src/main/java/at/chaosfield/openradio/init/Blocks.java

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
package at.chaosfield.openradio.init;
22

33
//import at.chaosfield.openradio.block.AEEncoderBlock;
4+
import at.chaosfield.openradio.OpenRadio;
5+
import at.chaosfield.openradio.block.BaseItemBlock;
46
import at.chaosfield.openradio.block.LaserBlock;
57
//import net.minecraftforge.fml.common.Loader;
68
import at.chaosfield.openradio.block.LensBlock;
9+
import net.minecraft.block.Block;
710
import net.minecraftforge.fml.common.registry.GameRegistry;
811

912
/**
@@ -22,13 +25,22 @@ public static void init(){
2225
lensBlock1 = new LensBlock(1);
2326
lensBlock2 = new LensBlock(2);
2427
lensBlock3 = new LensBlock(3);
25-
GameRegistry.registerBlock(laserBlock, "laser");
26-
GameRegistry.registerBlock(lensBlock1, "lenst1");
27-
GameRegistry.registerBlock(lensBlock2, "lenst2");
28-
GameRegistry.registerBlock(lensBlock3, "lenst3");
28+
29+
registerBlock(laserBlock, new BaseItemBlock(laserBlock), "laser");
30+
registerBlock(lensBlock1, new BaseItemBlock(lensBlock1), "lenst1");
31+
registerBlock(lensBlock2, new BaseItemBlock(lensBlock2), "lenst2");
32+
registerBlock(lensBlock3, new BaseItemBlock(lensBlock3), "lenst3");
2933
/*if(Loader.isModLoaded("appliedenergistics2")) {
3034
aeencoderBlock = new AEEncoderBlock();
31-
GameRegistry.registerBlock(aeencoderBlock, "aeencoder");
35+
ItemUtil.registerBlock(aeencoderBlock, "aeencoder");
3236
}*/
3337
}
38+
39+
public static void registerBlock(Block block, BaseItemBlock itemBlock, String name){
40+
block.setUnlocalizedName(OpenRadio.MODID+"."+name);
41+
block.setRegistryName(OpenRadio.MODID, name);
42+
GameRegistry.register(block);
43+
itemBlock.setRegistryName(block.getRegistryName());
44+
GameRegistry.register(itemBlock);
45+
}
3446
}

src/main/resources/assets/openradio/blockstates/laser.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"laser": "openradio:blocks/laser"
66
},
77
"model": "openradio:laser",
8-
"particle": "openradio:blocks/laser"
8+
"particle": "openradio:blocks/laser",
9+
"transform": "forge:default-block"
910
},
1011
"variants": {
1112
"facing":{

src/main/resources/assets/openradio/blockstates/lenst1.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"particle": "openradio:blocks/LensBlock"
99
},
1010
"model": "openradio:lens",
11-
"particle": "openradio:blocks/LensBlock"
11+
"particle": "openradio:blocks/LensBlock",
12+
"transform": "forge:default-block"
1213
},
1314
"variants": {
1415
"facing":{

src/main/resources/assets/openradio/blockstates/lenst2.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"particle": "openradio:blocks/LensBlock"
99
},
1010
"model": "openradio:lens",
11-
"particle": "openradio:blocks/LensBlock"
11+
"particle": "openradio:blocks/LensBlock",
12+
"transform": "forge:default-block"
1213
},
1314
"variants": {
1415
"facing":{

src/main/resources/assets/openradio/blockstates/lenst3.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"particle": "openradio:blocks/LensBlock"
99
},
1010
"model": "openradio:lens",
11-
"particle": "openradio:blocks/LensBlock"
11+
"particle": "openradio:blocks/LensBlock",
12+
"transform": "forge:default-block"
1213
},
1314
"variants": {
1415
"facing":{
Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
{
2-
"parent": "builtin/generated",
2+
"parent": "item/generated",
33
"textures": {
44
"layer0": "openradio:items/adct1"
5-
},
6-
"display": {
7-
"thirdperson": {
8-
"rotation": [ -90, 0, 0 ],
9-
"translation": [ 0, 1, -3 ],
10-
"scale": [ 0.55, 0.55, 0.55 ]
11-
},
12-
"firstperson": {
13-
"rotation": [ 0, -135, 25 ],
14-
"translation": [ 0, 4, 2 ],
15-
"scale": [ 1.7, 1.7, 1.7 ]
16-
}
175
}
186
}
Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
{
2-
"parent": "builtin/generated",
2+
"parent": "item/generated",
33
"textures": {
44
"layer0": "openradio:items/adct2"
5-
},
6-
"display": {
7-
"thirdperson": {
8-
"rotation": [ -90, 0, 0 ],
9-
"translation": [ 0, 1, -3 ],
10-
"scale": [ 0.55, 0.55, 0.55 ]
11-
},
12-
"firstperson": {
13-
"rotation": [ 0, -135, 25 ],
14-
"translation": [ 0, 4, 2 ],
15-
"scale": [ 1.7, 1.7, 1.7 ]
16-
}
175
}
186
}
Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
{
2-
"parent": "builtin/generated",
2+
"parent": "item/generated",
33
"textures": {
44
"layer0": "openradio:items/adct3"
5-
},
6-
"display": {
7-
"thirdperson": {
8-
"rotation": [ -90, 0, 0 ],
9-
"translation": [ 0, 1, -3 ],
10-
"scale": [ 0.55, 0.55, 0.55 ]
11-
},
12-
"firstperson": {
13-
"rotation": [ 0, -135, 25 ],
14-
"translation": [ 0, 4, 2 ],
15-
"scale": [ 1.7, 1.7, 1.7 ]
16-
}
175
}
186
}
Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
{
2-
"parent": "builtin/generated",
2+
"parent": "item/generated",
33
"textures": {
44
"layer0": "openradio:items/dspt1"
5-
},
6-
"display": {
7-
"thirdperson": {
8-
"rotation": [ -90, 0, 0 ],
9-
"translation": [ 0, 1, -3 ],
10-
"scale": [ 0.55, 0.55, 0.55 ]
11-
},
12-
"firstperson": {
13-
"rotation": [ 0, -135, 25 ],
14-
"translation": [ 0, 4, 2 ],
15-
"scale": [ 1.7, 1.7, 1.7 ]
16-
}
175
}
186
}
Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
{
2-
"parent": "builtin/generated",
2+
"parent": "item/generated",
33
"textures": {
44
"layer0": "openradio:items/dspt2"
5-
},
6-
"display": {
7-
"thirdperson": {
8-
"rotation": [ -90, 0, 0 ],
9-
"translation": [ 0, 1, -3 ],
10-
"scale": [ 0.55, 0.55, 0.55 ]
11-
},
12-
"firstperson": {
13-
"rotation": [ 0, -135, 25 ],
14-
"translation": [ 0, 4, 2 ],
15-
"scale": [ 1.7, 1.7, 1.7 ]
16-
}
175
}
186
}
Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
{
2-
"parent": "builtin/generated",
2+
"parent": "item/generated",
33
"textures": {
44
"layer0": "openradio:items/dspt3"
5-
},
6-
"display": {
7-
"thirdperson": {
8-
"rotation": [ -90, 0, 0 ],
9-
"translation": [ 0, 1, -3 ],
10-
"scale": [ 0.55, 0.55, 0.55 ]
11-
},
12-
"firstperson": {
13-
"rotation": [ 0, -135, 25 ],
14-
"translation": [ 0, 4, 2 ],
15-
"scale": [ 1.7, 1.7, 1.7 ]
16-
}
175
}
186
}
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
11
{
2-
"parent": "openradio:block/laser",
3-
"display": {
4-
"thirdperson": {
5-
"rotation": [ 10, -45, 170 ],
6-
"translation": [ 0, 1.5, -2.75 ],
7-
"scale": [ 0.375, 0.375, 0.375 ]
8-
}
9-
}
2+
"parent": "openradio:block/laser"
103
}
Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
{
2-
"parent": "builtin/generated",
2+
"parent": "item/generated",
33
"textures": {
44
"layer0": "openradio:items/lasersocket"
5-
},
6-
"display": {
7-
"thirdperson": {
8-
"rotation": [ -90, 0, 0 ],
9-
"translation": [ 0, 1, -3 ],
10-
"scale": [ 0.55, 0.55, 0.55 ]
11-
},
12-
"firstperson": {
13-
"rotation": [ 0, -135, 25 ],
14-
"translation": [ 0, 4, 2 ],
15-
"scale": [ 1.7, 1.7, 1.7 ]
16-
}
175
}
186
}
Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
{
2-
"parent": "builtin/generated",
2+
"parent": "item/generated",
33
"textures": {
44
"layer0": "openradio:items/lasert1"
5-
},
6-
"display": {
7-
"thirdperson": {
8-
"rotation": [ -90, 0, 0 ],
9-
"translation": [ 0, 1, -3 ],
10-
"scale": [ 0.55, 0.55, 0.55 ]
11-
},
12-
"firstperson": {
13-
"rotation": [ 0, -135, 25 ],
14-
"translation": [ 0, 4, 2 ],
15-
"scale": [ 1.7, 1.7, 1.7 ]
16-
}
175
}
186
}
Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
{
2-
"parent": "builtin/generated",
2+
"parent": "item/generated",
33
"textures": {
44
"layer0": "openradio:items/lasert2"
5-
},
6-
"display": {
7-
"thirdperson": {
8-
"rotation": [ -90, 0, 0 ],
9-
"translation": [ 0, 1, -3 ],
10-
"scale": [ 0.55, 0.55, 0.55 ]
11-
},
12-
"firstperson": {
13-
"rotation": [ 0, -135, 25 ],
14-
"translation": [ 0, 4, 2 ],
15-
"scale": [ 1.7, 1.7, 1.7 ]
16-
}
175
}
186
}

0 commit comments

Comments
 (0)