From b5dd84b06f97e1df51a7180fff30883be889c64f Mon Sep 17 00:00:00 2001 From: XDjackieXD Date: Tue, 14 Jun 2016 20:17:10 +0200 Subject: [PATCH] Fix laser tile id (aka fixing legacy "I was a noob" code). fixes #12 Prevent annoying burning in creative mode when standing in front of a laser --- .../openradio/entity/LaserEntity.java | 24 ++++++++++--------- .../openradio/proxy/CommonProxy.java | 3 ++- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/main/java/at/chaosfield/openradio/entity/LaserEntity.java b/src/main/java/at/chaosfield/openradio/entity/LaserEntity.java index a1c946a..bd05391 100644 --- a/src/main/java/at/chaosfield/openradio/entity/LaserEntity.java +++ b/src/main/java/at/chaosfield/openradio/entity/LaserEntity.java @@ -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; @@ -214,17 +215,18 @@ public void onEntityUpdate(){ List 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: + } } } } diff --git a/src/main/java/at/chaosfield/openradio/proxy/CommonProxy.java b/src/main/java/at/chaosfield/openradio/proxy/CommonProxy.java index ca3f8bd..aa74bb3 100644 --- a/src/main/java/at/chaosfield/openradio/proxy/CommonProxy.java +++ b/src/main/java/at/chaosfield/openradio/proxy/CommonProxy.java @@ -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; @@ -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"); }