Fusion reactor now kills the player, coils to come soon

This commit is contained in:
modmuss50 2016-03-05 19:09:07 +00:00
parent 1e24d1f116
commit 71062a55bd
3 changed files with 46 additions and 25 deletions

View file

@ -1,6 +1,7 @@
package techreborn.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
@ -11,11 +12,10 @@ import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.fusionReactor.TileEntityFusionController;
import techreborn.utils.damageSources.FusionDamageSource;
public class BlockFusionControlComputer extends BlockMachineBase implements IAdvancedRotationTexture {
public BlockFusionControlComputer(Material material) {
super();
setUnlocalizedName("techreborn.fusioncontrolcomputer");
@ -33,6 +33,15 @@ public class BlockFusionControlComputer extends BlockMachineBase implements IAdv
return true;
}
@Override
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, Entity entityIn) {
super.onEntityCollidedWithBlock(worldIn, pos, entityIn);
if(worldIn.getTileEntity(pos) instanceof TileEntityFusionController){
if(((TileEntityFusionController) worldIn.getTileEntity(pos)).crafingTickTime != 0 && ((TileEntityFusionController) worldIn.getTileEntity(pos)).checkCoils()){
entityIn.attackEntityFrom(new FusionDamageSource(), 200F);
}
}
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {

View file

@ -50,16 +50,16 @@ public class GuiFusionReactor extends GuiContainer {
public void initGui() {
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
GuiButton button = new GuiButton(212, k + this.xSize - 24, l + 4, 20, 20, "");
buttonList.add(button);
//GuiButton button = new GuiButton(212, k + this.xSize - 24, l + 4, 20, 20, "");
//buttonList.add(button);
super.initGui();
CoordTriplet coordinates = new CoordTriplet(fusionController.getPos().getX() - (EnumFacing.getFront(fusionController.getFacingInt()).getFrontOffsetX() * 2), fusionController.getPos().getY() - 1, fusionController.getPos().getZ() - (EnumFacing.getFront(fusionController.getFacingInt()).getFrontOffsetZ() * 2));
if(coordinates.equals(ClientProxy.multiblockRenderEvent.anchor)){
ClientProxy.multiblockRenderEvent.setMultiblock(null);
button.displayString = "B";
} else {
button.displayString = "A";
}
// CoordTriplet coordinates = new CoordTriplet(fusionController.getPos().getX() - (EnumFacing.getFront(fusionController.getFacingInt()).getFrontOffsetX() * 2), fusionController.getPos().getY() - 1, fusionController.getPos().getZ() - (EnumFacing.getFront(fusionController.getFacingInt()).getFrontOffsetZ() * 2));
// if(coordinates.equals(ClientProxy.multiblockRenderEvent.anchor)){
// ClientProxy.multiblockRenderEvent.setMultiblock(null);
// button.displayString = "B";
// } else {
// button.displayString = "A";
// }
}
@Override
@ -86,19 +86,19 @@ public class GuiFusionReactor extends GuiContainer {
@Override
public void actionPerformed(GuiButton button) throws IOException {
super.actionPerformed(button);
if(button.id == 212){
if(ClientProxy.multiblockRenderEvent.currentMultiblock == null){
{//This code here makes a basic multiblock and then sets to the selected one.
MultiblockSet set = new MultiblockSet(ClientMultiBlocks.reactor);
ClientProxy.multiblockRenderEvent.setMultiblock(set);
ClientProxy.multiblockRenderEvent.partent = new Location(fusionController.getPos().getX(), fusionController.getPos().getY(), fusionController.getPos().getZ(), fusionController.getWorld());
ClientProxy.multiblockRenderEvent.anchor = new CoordTriplet(fusionController.getPos().getX() , fusionController.getPos().getY() -1 , fusionController.getPos().getZ());
}
button.displayString = "A";
} else {
ClientProxy.multiblockRenderEvent.setMultiblock(null);
button.displayString = "B";
}
}
// if(button.id == 212){
// if(ClientProxy.multiblockRenderEvent.currentMultiblock == null){
// {//This code here makes a basic multiblock and then sets to the selected one.
// MultiblockSet set = new MultiblockSet(ClientMultiBlocks.reactor);
// ClientProxy.multiblockRenderEvent.setMultiblock(set);
// ClientProxy.multiblockRenderEvent.partent = new Location(fusionController.getPos().getX(), fusionController.getPos().getY(), fusionController.getPos().getZ(), fusionController.getWorld());
// ClientProxy.multiblockRenderEvent.anchor = new CoordTriplet(fusionController.getPos().getX() , fusionController.getPos().getY() -1 , fusionController.getPos().getZ());
// }
// button.displayString = "A";
// } else {
// ClientProxy.multiblockRenderEvent.setMultiblock(null);
// button.displayString = "B";
// }
// }
}
}

View file

@ -0,0 +1,12 @@
package techreborn.utils.damageSources;
import net.minecraft.util.DamageSource;
/**
* Created by Mark on 05/03/2016.
*/
public class FusionDamageSource extends DamageSource {
public FusionDamageSource() {
super("fusion");
}
}