use of micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats in project Galacticraft by micdoodle8.
the class ColorUtil method sendUpdatedColorsToPlayer.
public static void sendUpdatedColorsToPlayer(GCPlayerStats stats) {
int dimID = stats.getPlayer().get().dimension;
GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_RECOLOR_ALL_GLASS, dimID, new Object[] { Integer.valueOf(stats.getGlassColor1()), Integer.valueOf(stats.getGlassColor2()), Integer.valueOf(stats.getGlassColor3()) }), stats.getPlayer().get());
}
use of micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats in project Galacticraft by micdoodle8.
the class TileEntityPanelLight method initialise.
public void initialise(int type, EnumFacing facing, EntityPlayer player, boolean isRemote, IBlockState superStateClient) {
this.meta = facing.ordinal();
if (isRemote) {
this.superState = superStateClient;
this.color = BlockPanelLighting.color;
} else {
GCPlayerStats stats = GCPlayerStats.get(player);
this.superState = stats.getPanelLightingBases()[type];
this.color = stats.getPanelLightingColor();
}
}
use of micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats in project Galacticraft by micdoodle8.
the class EntitySlimeling method processInteract.
@Override
public boolean processInteract(EntityPlayer player, EnumHand hand) {
ItemStack itemstack = player.inventory.getCurrentItem();
if (this.isTamed()) {
if (!itemstack.isEmpty()) {
if (itemstack.getItem() == this.getFavoriteFood()) {
if (this.isOwner(player)) {
itemstack.shrink(1);
if (itemstack.isEmpty()) {
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
}
if (this.world.isRemote) {
MarsModuleClient.openSlimelingGui(this, 1);
}
if (this.rand.nextInt(3) == 0) {
this.setRandomFavFood();
}
} else {
if (player instanceof EntityPlayerMP) {
GCPlayerStats stats = GCPlayerStats.get(player);
if (stats.getChatCooldown() == 0) {
player.sendMessage(new TextComponentString(GCCoreUtil.translate("gui.slimeling.chat.wrong_player")));
stats.setChatCooldown(100);
}
}
}
} else {
if (this.world.isRemote) {
MarsModuleClient.openSlimelingGui(this, 0);
}
}
} else {
if (this.world.isRemote) {
MarsModuleClient.openSlimelingGui(this, 0);
}
}
return true;
} else if (!itemstack.isEmpty() && itemstack.getItem() == Items.SLIME_BALL) {
if (!player.capabilities.isCreativeMode) {
itemstack.shrink(1);
}
if (itemstack.isEmpty()) {
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
}
if (!this.world.isRemote) {
if (this.rand.nextInt(3) == 0) {
this.setTamed(true);
this.getNavigator().clearPath();
this.setAttackTarget(null);
this.setSittingAI(true);
this.setHealth(20.0F);
this.setOwnerId(player.getUniqueID());
this.setOwnerUsername(player.getName());
this.playTameEffect(true);
this.world.setEntityState(this, (byte) 7);
} else {
this.playTameEffect(false);
this.world.setEntityState(this, (byte) 6);
}
}
return true;
}
return super.processInteract(player, hand);
}
use of micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats in project Galacticraft by micdoodle8.
the class EntityAutoRocket method onLaunch.
@Override
public void onLaunch() {
if (!(this.world.provider.getDimension() == GalacticraftCore.planetOverworld.getDimensionID() || this.world.provider instanceof IGalacticraftWorldProvider)) {
if (ConfigManagerCore.disableRocketLaunchAllNonGC) {
this.cancelLaunch();
return;
}
// No rocket flight in the Nether, the End etc
for (int i = ConfigManagerCore.disableRocketLaunchDimensions.length - 1; i >= 0; i--) {
if (ConfigManagerCore.disableRocketLaunchDimensions[i] == this.world.provider.getDimension()) {
this.cancelLaunch();
return;
}
}
}
super.onLaunch();
if (!this.world.isRemote) {
GCPlayerStats stats = null;
if (!this.getPassengers().isEmpty()) {
for (Entity player : this.getPassengers()) {
if (player instanceof EntityPlayerMP) {
stats = GCPlayerStats.get(player);
stats.setLaunchpadStack(null);
if (!(this.world.provider instanceof IOrbitDimension)) {
stats.setCoordsTeleportedFromX(player.posX);
stats.setCoordsTeleportedFromZ(player.posZ);
}
}
}
Entity playerMain = this.getPassengers().get(0);
if (playerMain instanceof EntityPlayerMP)
stats = GCPlayerStats.get(playerMain);
}
int amountRemoved = 0;
PADSEARCH: for (int x = MathHelper.floor(this.posX) - 1; x <= MathHelper.floor(this.posX) + 1; x++) {
for (int y = MathHelper.floor(this.posY) - 3; y <= MathHelper.floor(this.posY) + 1; y++) {
for (int z = MathHelper.floor(this.posZ) - 1; z <= MathHelper.floor(this.posZ) + 1; z++) {
BlockPos pos = new BlockPos(x, y, z);
final Block block = this.world.getBlockState(pos).getBlock();
if (block != null && block instanceof BlockLandingPadFull) {
if (amountRemoved < 9) {
EventLandingPadRemoval event = new EventLandingPadRemoval(this.world, pos);
MinecraftForge.EVENT_BUS.post(event);
if (event.allow) {
this.world.setBlockToAir(pos);
amountRemoved = 9;
}
break PADSEARCH;
}
}
}
}
}
// Set the player's launchpad item for return on landing - or null if launchpads not removed
if (stats != null && amountRemoved == 9) {
stats.setLaunchpadStack(new ItemStack(GCBlocks.landingPad, 9, 0));
}
this.playSound(SoundEvents.ENTITY_ITEM_PICKUP, 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
}
}
use of micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats in project Galacticraft by micdoodle8.
the class EntityTieredRocket method processInitialInteract.
@Override
public boolean processInitialInteract(EntityPlayer player, EnumHand hand) {
if (hand != EnumHand.MAIN_HAND) {
return false;
}
if (this.launchPhase >= EnumLaunchPhase.LAUNCHED.ordinal()) {
return false;
}
if (!this.getPassengers().isEmpty() && this.getPassengers().contains(player)) {
if (!this.world.isRemote) {
GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_RESET_THIRD_PERSON, this.world.provider.getDimension(), new Object[] {}), (EntityPlayerMP) player);
GCPlayerStats stats = GCPlayerStats.get(player);
stats.setChatCooldown(0);
// Prevent player being dropped from the top of the rocket...
float heightBefore = this.height;
this.height = this.height / 2.0F;
this.removePassengers();
this.height = heightBefore;
}
return true;
} else if (player instanceof EntityPlayerMP) {
if (!this.world.isRemote) {
GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_DISPLAY_ROCKET_CONTROLS, this.world.provider.getDimension(), new Object[] {}), (EntityPlayerMP) player);
GCPlayerStats stats = GCPlayerStats.get(player);
stats.setChatCooldown(0);
player.startRiding(this);
}
return true;
}
return false;
}
Aggregations