Skip to content

Commit

Permalink
Ra's Fury now does additional damage, when hit entity is already on fire
Browse files Browse the repository at this point in the history
Changed crate lid animation
Fixed Kiln automation
Fixed last build failing
Fixed Atem pharaoh entity texture name being incorrect
  • Loading branch information
GirafiStudios committed Nov 5, 2020
1 parent 28876b0 commit 4af20ae
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,20 @@
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.wrapper.SidedInvWrapper;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

public class KilnBaseTileEntity extends InventoryBaseTileEntity implements ISidedInventory {
private BlockPos primaryPos;
private static final int[] SLOTS_TOP = new int[]{0, 1, 2, 3};
private static final int[] SLOTS_BOTTOM = new int[]{5, 6, 7, 8};
private static final int[] SLOTS_SIDES = new int[]{4};

KilnBaseTileEntity(TileEntityType<?> tileType) {
super(tileType, 9);
Expand Down Expand Up @@ -89,7 +98,11 @@ public int[] getSlotsForFace(@Nonnull Direction side) {
return primary.getSlotsForFace(side);
}
}
return new int[0];
if (side == Direction.DOWN) {
return SLOTS_BOTTOM;
} else {
return side == Direction.UP ? SLOTS_TOP : SLOTS_SIDES;
}
}

@Override
Expand Down Expand Up @@ -197,4 +210,26 @@ public void onDataPacket(NetworkManager manager, SUpdateTileEntityPacket packet)
public CompoundNBT getUpdateTag() {
return this.write(new CompoundNBT());
}

private final LazyOptional<? extends IItemHandler>[] handlers = SidedInvWrapper.create(this, Direction.UP, Direction.DOWN, Direction.WEST);

@Override
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> capability, @Nullable Direction facing) {
if (!isPrimary()) {
KilnBaseTileEntity primary = getPrimary();
if (primary != null) {
return primary.getCapability(capability, facing);
}
}
if (!this.removed && facing != null && capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
if (facing == Direction.UP) {
return handlers[0].cast();
} else if (facing == Direction.DOWN) {
return handlers[1].cast();
} else {
return handlers[2].cast();
}
}
return super.getCapability(capability, facing);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,15 @@ public BlockRenderType getRenderType(@Nonnull BlockState state) {
public ActionResultType onBlockActivated(@Nonnull BlockState state, World world, @Nonnull BlockPos pos, @Nonnull PlayerEntity player, @Nonnull Hand hand, @Nonnull BlockRayTraceResult rayTrace) {
if (world.isRemote) {
return ActionResultType.SUCCESS;
} else {
} else if (!ChestBlock.isBlocked(world, pos)) {
TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity instanceof CrateTileEntity) {
player.openContainer((CrateTileEntity) tileEntity);
player.addStat(Stats.CUSTOM.get(Stats.OPEN_CHEST));
}
return ActionResultType.SUCCESS;
}
return super.onBlockActivated(state, world, pos, player, hand, rayTrace);
}

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void render(@Nonnull CrateTileEntity crate, float partialTicks, @Nonnull
}

private void renderCrate(MatrixStack matrixStack, IVertexBuilder vertexBuilder, ModelRenderer core, ModelRenderer lid, float lidAngle, int light, int combinedOverlay) {
lid.rotateAngleY = (lidAngle * ((float) Math.PI / 3.5F));
lid.rotateAngleZ = (lidAngle * ((float) Math.PI / 10.0F));
core.render(matrixStack, vertexBuilder, light, combinedOverlay);
lid.render(matrixStack, vertexBuilder, light, combinedOverlay);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.EntityRayTraceResult;
Expand All @@ -32,7 +33,13 @@ protected void onEntityHit(@Nonnull EntityRayTraceResult rayTraceResult) {
super.onEntityHit(rayTraceResult);
Entity hitEnity = rayTraceResult.getEntity();
if (hitEnity instanceof LivingEntity) {
hitEnity.setFire(5);
if (!hitEnity.isImmuneToFire()) {
if (hitEnity.getFireTimer() > 0) {
this.setDamage(this.getDamage() * 1.5D);
this.playSound(SoundEvents.ITEM_FIRECHARGE_USE, 1.0F, 1.0F);
}
hitEnity.setFire(5);
}
}
}

Expand All @@ -43,8 +50,8 @@ protected void func_230299_a_(@Nonnull BlockRayTraceResult rayTraceResult) {
if (shooter instanceof PlayerEntity) {
BlockPos pos = rayTraceResult.getPos().offset(rayTraceResult.getFace());
PlayerEntity player = (PlayerEntity) shooter;
if (player.canPlayerEdit(pos, rayTraceResult.getFace(), player.getHeldItem(player.getActiveHand())) && world.getBlockState(pos).getMaterial() == Material.AIR) {
world.setBlockState(pos, Blocks.FIRE.getDefaultState());
if (player.canPlayerEdit(pos, rayTraceResult.getFace(), player.getHeldItem(player.getActiveHand())) && this.world.getBlockState(pos).getMaterial() == Material.AIR) {
this.world.setBlockState(pos, Blocks.FIRE.getDefaultState());
}
}
}
Expand All @@ -54,9 +61,9 @@ public void tick() {
super.tick();

if (this.getIsCritical()) {
if (world instanceof ServerWorld) {
ServerWorld serverWorld = (ServerWorld) world;
serverWorld.spawnParticle(AtumParticles.RA_FIRE, this.getPosX() + (world.rand.nextDouble() - 0.5D) * (double) this.getWidth(), this.getPosY() + world.rand.nextDouble() * (double) this.getHeight(), this.getPosZ() + (world.rand.nextDouble() - 0.5D) * (double) this.getWidth(), 2, 0.0D, 0.0D, 0.0D, 0.01D);
if (this.world instanceof ServerWorld) {
ServerWorld serverWorld = (ServerWorld) this.world;
serverWorld.spawnParticle(AtumParticles.RA_FIRE, this.getPosX() + (this.world.rand.nextDouble() - 0.5D) * (double) this.getWidth(), this.getPosY() + this.world.rand.nextDouble() * (double) this.getHeight(), this.getPosZ() + (this.world.rand.nextDouble() - 0.5D) * (double) this.getWidth(), 2, 0.0D, 0.0D, 0.0D, 0.01D);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public void buildSurface(@Nonnull Random random, @Nonnull IChunk chunk, @Nonnull
y++;
if (chunk.getBlockState(mutablePos).isAir()) {
chunk.setBlockState(mutablePos, Blocks.WATER.getDefaultState(), true);
chunk.tic
}
}

Expand Down

0 comments on commit 4af20ae

Please sign in to comment.