Skip to content

Commit

Permalink
Fix laser tile id (aka fixing legacy "I was a noob" code). fixes #12
Browse files Browse the repository at this point in the history
Prevent annoying burning in creative mode when standing in front of a laser
  • Loading branch information
XDjackieXD committed Jun 14, 2016
1 parent ba02ab7 commit b5dd84b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
24 changes: 13 additions & 11 deletions src/main/java/at/chaosfield/openradio/entity/LaserEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import at.chaosfield.openradio.util.Location;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
Expand Down Expand Up @@ -214,17 +215,18 @@ public void onEntityUpdate(){
List<Entity> list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().addCoord(this.motionX, this.motionY, this.motionZ));
for(Entity entity : list){
if(entity instanceof EntityLivingBase && entity.canBeCollidedWith()){
switch(this.laserTier){
case 2:
entity.attackEntityFrom(DamageSourceLaser.DAMAGE_SOURCE_LASER, 3);
entity.setFire(1);
break;
case 3:
entity.attackEntityFrom(DamageSourceLaser.DAMAGE_SOURCE_LASER, 6);
entity.setFire(10);
break;
default:
}
if(!(entity instanceof EntityPlayer && ((EntityPlayer) entity).isCreative()))
switch(this.laserTier){
case 2:
entity.attackEntityFrom(DamageSourceLaser.DAMAGE_SOURCE_LASER, 3);
entity.setFire(1);
break;
case 3:
entity.attackEntityFrom(DamageSourceLaser.DAMAGE_SOURCE_LASER, 6);
entity.setFire(10);
break;
default:
}
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/at/chaosfield/openradio/proxy/CommonProxy.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package at.chaosfield.openradio.proxy;


import at.chaosfield.openradio.OpenRadio;
import at.chaosfield.openradio.tileentity.LaserTileEntity;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
Expand All @@ -12,7 +13,7 @@
public class CommonProxy{

public void init(FMLInitializationEvent event){
GameRegistry.registerTileEntity(LaserTileEntity.class, "laser");
GameRegistry.registerTileEntityWithAlternatives(LaserTileEntity.class, OpenRadio.MODID + ":laser");
//if(Loader.isModLoaded("appliedenergistics2"))
// GameRegistry.registerTileEntity(AEEncoderTileEntity.class, OpenRadio.MODID + ":aeencoder");
}
Expand Down

0 comments on commit b5dd84b

Please sign in to comment.