Skip to content

Commit

Permalink
Commit 6cd562c changes reverted
Browse files Browse the repository at this point in the history
Changes in 6cd562c commit have been partially reverted
  • Loading branch information
capsey committed Jan 21, 2022
1 parent 14df9a0 commit 8ba6843
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void setLootTable(Identifier id) {
public void startBrushing(PlayerEntity player, ItemStack stack) {
if (stack.isOf(Items.COPPER_BRUSH)) {
this.brushingPlayer = player;
this.brushTicks = CopperBrushItem.getBrushTicks(stack, player);
this.brushTicks = CopperBrushItem.getBrushTicks(stack);
generateLoot(player, stack);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,9 @@

public class CopperBrushItem extends Item {

private static final int CREATIVE_BRUSH_TICKS = 5;
private static final int[] BRUSH_TICKS = { 8, 7, 6, 5 };

public static int getBrushTicks(ItemStack stack, LivingEntity user) {
if (user instanceof PlayerEntity player && player.isCreative()) {
return CREATIVE_BRUSH_TICKS;
}

public static int getBrushTicks(ItemStack stack) {
return BRUSH_TICKS[getOxidizationIndex(stack)];
}

Expand Down Expand Up @@ -65,7 +60,7 @@ public ActionResult useOnBlock(ItemUsageContext context) {
@Override
public void usageTick(World world, LivingEntity user, ItemStack stack, int remainingUseTicks) {
if (!world.isClient) {
int brushTicks = CopperBrushItem.getBrushTicks(stack, user);
int brushTicks = CopperBrushItem.getBrushTicks(stack);

if (remainingUseTicks % (brushTicks * ExcavationBlock.getBrushTicksPerLayer(world.getDifficulty())) == 0) {
int damage = world.getRandom().nextInt(2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ private void renderFirstPersonItem(AbstractClientPlayerEntity player, float tick
boolean bl = arm == Arm.RIGHT;

int side = bl ? 1 : -1;
int max = CopperBrushItem.getBrushTicks(item, player) * ExcavationBlock.MAX_BRUSHING_LEVELS;
int max = CopperBrushItem.getBrushTicks(item) * ExcavationBlock.MAX_BRUSHING_LEVELS;
float progress = (float) player.getItemUseTime() / max;
float angle_coef = MathHelper.sin(ExcavationBlock.MAX_BRUSHING_LEVELS * progress * 3.1415927F);
float angleCoef = MathHelper.sin(ExcavationBlock.MAX_BRUSHING_LEVELS * progress * 3.1415927F);

matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(-60.0F));
matrices.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(-45.0F));

matrices.translate(-0.3D, 0.3D, -1.0D);
matrices.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(side * 40.0F * angle_coef));
matrices.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(side * 40.0F * angleCoef));
matrices.translate(-0.2D, 0.2D, 0.0D);

((HeldItemRenderer)(Object) this).renderItem(player, item, ModelTransformation.Mode.FIXED, !bl, matrices, vertexConsumers, light);
Expand Down

0 comments on commit 8ba6843

Please sign in to comment.