-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
- Loading branch information
Showing
24 changed files
with
285 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/main/java/org/confluence/mod/datagen/limit/Image24xAdjustmentExamples.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.confluence.mod.datagen.limit; | ||
|
||
import net.minecraftforge.client.model.generators.ItemModelBuilder; | ||
|
||
import static net.minecraft.world.item.ItemDisplayContext.*; | ||
|
||
public interface Image24xAdjustmentExamples { | ||
default void preset(ItemModelBuilder builder) { | ||
builder.transforms() | ||
.transform(THIRD_PERSON_RIGHT_HAND).translation(0, 14, 2).rotation(60, 90, 0).scale(1.5F, 1.5F, 1F).end() | ||
.transform(THIRD_PERSON_LEFT_HAND).translation(-1, 14, 2).rotation(-45, 85, 0).scale(1.5F, 1.5F, 1F).end() | ||
.transform(FIRST_PERSON_RIGHT_HAND).rotation(-20F, -80F, 0).translation(3, 8, 0).scale(1.5F, 1.5F, 1F).end() | ||
.transform(FIRST_PERSON_LEFT_HAND).rotation(0, 105F, 0).translation(0, 8, 5).scale(0.5F, 1F, 1F).end() | ||
.transform(GROUND).scale(1F, 1F, 0.5F).translation(0F, 4F, 0).end() | ||
.transform(GUI).translation(2.8F, 2.8F, 0).scale(1.3F).rotation(0, 0, 0).end() | ||
.transform(FIXED).translation(-4.5F, 4.5F, 0).scale(1.5F).rotation(0, 0, 90).end(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package org.confluence.mod.item.axe; | ||
|
||
import net.minecraft.world.item.AxeItem; | ||
import net.minecraft.world.item.Tier; | ||
import org.confluence.mod.datagen.limit.Image24x; | ||
|
||
public class BigAxeItem extends AxeItem implements Image24x { | ||
public BigAxeItem(Tier tier, float rawDamage, float rawSpeed) { | ||
this(tier, rawDamage, rawSpeed, new Properties()); | ||
} | ||
|
||
public BigAxeItem(Tier tier, float rawDamage, float rawSpeed, Properties properties) { | ||
super(tier, rawDamage - tier.getAttackDamageBonus() - 1, rawSpeed - 4, properties); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/org/confluence/mod/item/food/BowlFoodItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.confluence.mod.item.food; | ||
|
||
import net.minecraft.sounds.SoundEvent; | ||
import net.minecraft.sounds.SoundEvents; | ||
import net.minecraft.world.food.FoodProperties; | ||
import net.minecraft.world.item.Item; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.UseAnim; | ||
|
||
import static net.minecraft.world.item.Items.BOWL; | ||
import static net.minecraft.world.item.Items.GLASS_BOTTLE; | ||
|
||
public class BowlFoodItem extends Item { | ||
public BowlFoodItem(FoodProperties foodProperties) { | ||
super(new Properties().food(foodProperties).craftRemainder(BOWL).stacksTo(64)); | ||
} | ||
public int getUseDuration(ItemStack p_41360_) { | ||
return 20; | ||
} | ||
|
||
public UseAnim getUseAnimation(ItemStack p_41358_) { | ||
return UseAnim.DRINK; | ||
} | ||
|
||
public SoundEvent getDrinkingSound() { | ||
return SoundEvents.HONEY_DRINK; | ||
} | ||
|
||
public SoundEvent getEatingSound() { | ||
return SoundEvents.HONEY_DRINK; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
src/main/java/org/confluence/mod/item/hammer/BigHammerItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package org.confluence.mod.item.hammer; | ||
|
||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.tags.BlockTags; | ||
import net.minecraft.world.entity.EquipmentSlot; | ||
import net.minecraft.world.entity.LivingEntity; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.item.DiggerItem; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.Tier; | ||
import net.minecraft.world.level.Level; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import net.minecraft.world.phys.BlockHitResult; | ||
import org.confluence.mod.datagen.limit.Image24x; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.stream.Stream; | ||
|
||
public class BigHammerItem extends HammerItem implements Image24x { | ||
public BigHammerItem(Tier tier, float rawDamage, float rawSpeed) { | ||
this(tier, rawDamage, rawSpeed, new Properties()); | ||
} | ||
|
||
public BigHammerItem(Tier tier, float rawDamage, float rawSpeed, Properties properties) { | ||
super(rawDamage - tier.getAttackDamageBonus() - 1, rawSpeed - 4, tier, BlockTags.WALLS, properties); | ||
} | ||
|
||
@Override | ||
public boolean mineBlock(@NotNull ItemStack stack, @NotNull Level level, @NotNull BlockState state, @NotNull BlockPos pos, @NotNull LivingEntity entity) { | ||
if (!level.isClientSide) { | ||
int destroyCount = 1; | ||
if (entity instanceof Player player) { | ||
BlockHitResult picked = (BlockHitResult) player.pick(10, 1.0F, true); | ||
boolean xOff = true, yOff = true, zOff = true; | ||
switch (picked.getDirection()) { | ||
case NORTH, SOUTH -> zOff = false; | ||
case WEST, EAST -> xOff = false; | ||
default -> yOff = false; | ||
} | ||
destroyCount += iteForBlocks(level, player, pos, xOff, yOff, zOff, state.getDestroySpeed(level, pos) * 1.5F); | ||
} | ||
if (state.getDestroySpeed(level, pos) != 0.0F) { | ||
stack.hurtAndBreak(destroyCount, entity, (entity1) -> entity1.broadcastBreakEvent(EquipmentSlot.MAINHAND)); | ||
} | ||
} | ||
return true; | ||
} | ||
|
||
/** | ||
* Scan 3*1*3 blocks related to the given pos. | ||
*/ | ||
public static int iteForBlocks(Level level, Player player, @NotNull BlockPos pos, boolean xOff, boolean yOff, boolean zOff, float speedOff) { | ||
Stream<BlockPos> posStream = BlockPos.betweenClosedStream(pos.offset(xOff? 1:0, yOff? 1:0, zOff? 1:0), pos.offset(xOff? -1:0, yOff? -1:0, zOff? -1:0)); | ||
return (int) posStream.filter(pos1 -> !pos1.equals(pos)) | ||
.map(pos1 -> applyBlockDestroy(level, pos1, player, speedOff)) | ||
.filter(destroyed -> destroyed) | ||
.count(); | ||
} | ||
|
||
/** | ||
* If the target block can hardly be break, skip it. | ||
* | ||
* @param pos The current producing block's pos(Target pos). | ||
* @param speedOff Related block's destroy speed * 1.5 (satisfied range). | ||
* @return TRUE, if the block has been broke, otherwise return FALSE. | ||
*/ | ||
public static boolean applyBlockDestroy(@NotNull Level level, BlockPos pos, Player player, float speedOff) { | ||
BlockState targetState = level.getBlockState(pos); | ||
float targetSpeed = targetState.getDestroySpeed(level, pos); | ||
boolean flag1 = targetState.canHarvestBlock(level, pos, player); | ||
boolean flag2 = speedOff > 0 ? targetSpeed >= 0 && speedOff >= targetSpeed : targetSpeed >= speedOff; | ||
boolean flag3 = player.getAbilities().instabuild; | ||
if (flag1 && flag2 || flag3) { | ||
level.destroyBlock(pos, flag1, player); | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean canDisableShield(ItemStack stack, ItemStack shield, LivingEntity entity, LivingEntity attacker) { | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.