Compare commits

..

10 Commits

Author SHA1 Message Date
Jottyfan
b063cd6ef2 experiments with loot table changes
Some checks are pending
build / build (21) (push) Waiting to run
2024-11-26 08:57:24 +01:00
Jottyfan
346ee85ca3 added crops - but loot table does not work yet 2024-11-25 21:10:27 +01:00
Jottyfan
4e4742ae11 added kelpstack 2024-11-24 21:46:28 +01:00
Jottyfan
529f40395e added ores 2024-11-23 23:04:56 +01:00
Jottyfan
6d2c1967fa added tools 2024-11-23 19:31:37 +01:00
Jottyfan
7993693d9c added itemhoarder with block entity 2024-11-21 21:42:29 +01:00
Jottyfan
451f19ea73 added lavahoarder 2024-11-20 21:55:49 +01:00
Jottyfan
04f87a977e added monster hoarder 2024-11-17 17:48:32 +01:00
Jottyfan
062d75fa93 added rooten flesh stripes and carrot stack 2024-11-16 18:25:22 +01:00
Jottyfan
fb6867f25b added ingots and oxidized copper powder 2024-11-16 00:43:40 +01:00
271 changed files with 4243 additions and 43 deletions

View File

@@ -6,11 +6,25 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.jottyfan.quickiemod.block.ModBlocks;
import de.jottyfan.quickiemod.blockentity.ModBlockentity;
import de.jottyfan.quickiemod.event.EventBlockBreak;
import de.jottyfan.quickiemod.feature.ModFeatures;
import de.jottyfan.quickiemod.item.ModItems;
import de.jottyfan.quickiemod.tab.ModTabs;
import de.jottyfan.quickiemod.itemgroup.ModItemGroup;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.event.player.PlayerBlockBreakEvents;
import net.fabricmc.fabric.api.loot.v3.LootTableEvents;
import net.fabricmc.fabric.api.registry.CompostingChanceRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.item.Item;
import net.minecraft.loot.LootPool;
import net.minecraft.loot.LootTable;
import net.minecraft.loot.condition.SurvivesExplosionLootCondition;
import net.minecraft.loot.entry.ItemEntry;
import net.minecraft.loot.entry.LeafEntry.Builder;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
/**
*
@@ -21,10 +35,42 @@ public class Quickiemod implements ModInitializer {
public static final String MOD_ID = "quickiemod";
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
private void registerComposterItems() {
CompostingChanceRegistry.INSTANCE.add(ModItems.ITEM_COTTONSEED, 0.5f);
CompostingChanceRegistry.INSTANCE.add(ModItems.ITEM_COTTON, 0.75f);
CompostingChanceRegistry.INSTANCE.add(ModItems.ITEM_CANOLASEED, 0.5f);
CompostingChanceRegistry.INSTANCE.add(ModItems.ITEM_CANOLA, 0.75f);
}
private void registerLootTableChanges() {
// does not work yet
LootTableEvents.MODIFY.register((key, tableBuilder, source, registries) -> {
if (Blocks.SHORT_GRASS.equals(key)) {
Builder<?> entry = ItemEntry.builder(ModItems.ITEM_COTTON);
LootPool.Builder poolBuilder = LootPool.builder().with(entry)
.conditionally(SurvivesExplosionLootCondition.builder());
tableBuilder.pool(poolBuilder);
} else if (Blocks.TALL_GRASS.getLootTableKey().equals(key)) {
Builder<?> entry = ItemEntry.builder(ModItems.ITEM_CANOLA);
LootPool.Builder poolBuilder = LootPool.builder().with(entry)
.conditionally(SurvivesExplosionLootCondition.builder());
tableBuilder.pool(poolBuilder);
}
});
}
@Override
public void onInitialize() {
ModBlockentity.registerModBlockentities();
List<Item> items = ModItems.registerModItems();
List<Block> blocks = ModBlocks.registerModBlocks();
ModTabs.registerTab(items, blocks);
ModFeatures.registerFeatures();
registerComposterItems();
registerLootTableChanges();
ModItemGroup.registerItemGroup(items, blocks);
PlayerBlockBreakEvents.AFTER.register((world, player, pos, state, blockEntity) -> {
Block oldBlock = state.getBlock();
new EventBlockBreak().doBreakBlock(world, pos, state, player, oldBlock);
});
}
}

View File

@@ -1,6 +1,9 @@
package de.jottyfan.quickiemod;
import de.jottyfan.quickiemod.block.ModBlocks;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.minecraft.client.render.RenderLayer;
/**
*
@@ -11,6 +14,7 @@ public class QuickiemodClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
BlockRenderLayerMap.INSTANCE.putBlock(ModBlocks.BLOCK_COTTONPLANT, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(ModBlocks.BLOCK_CANOLAPLANT, RenderLayer.getCutout());
}
}

View File

@@ -17,4 +17,9 @@ public abstract class AbstractIdentifiedBlock extends Block {
super(AbstractBlock.Settings.create().registryKey(RegistryKey.of(RegistryKeys.BLOCK, identifier)));
}
public AbstractIdentifiedBlock(Identifier identifier, float strength, float hardness) {
super(AbstractBlock.Settings.create().strength(strength).hardness(hardness).requiresTool()
.registryKey(RegistryKey.of(RegistryKeys.BLOCK, identifier)));
}
}

View File

@@ -0,0 +1,45 @@
package de.jottyfan.quickiemod.block;
import java.util.Arrays;
import java.util.List;
import com.mojang.serialization.MapCodec;
import net.minecraft.block.BlockState;
import net.minecraft.block.FallingBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootWorldContext.Builder;
import net.minecraft.util.Identifier;
import net.minecraft.world.explosion.Explosion;
/**
*
* @author jotty
*
*/
public class BlockBreakByTool extends AbstractIdentifiedBlock {
private final ItemStack[] drops;
public BlockBreakByTool(Identifier identifier, float strength, float hardness, ItemStack[] drops) {
super(identifier, strength, hardness);
this.drops = drops;
}
@Override
public List<ItemStack> getDroppedStacks(BlockState state, Builder builder) {
return Arrays.asList(drops);
}
@Override
public boolean shouldDropItemsOnExplosion(Explosion explosion) {
return true;
}
@Override
protected MapCodec<? extends FallingBlock> getCodec() {
// TODO Auto-generated method stub
return null;
}
}

View File

@@ -0,0 +1,48 @@
package de.jottyfan.quickiemod.block;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import com.mojang.serialization.MapCodec;
import de.jottyfan.quickiemod.item.ModItems;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.FallingBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.loot.context.LootWorldContext.Builder;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.Identifier;
/**
*
* @author jotty
*
*/
public class BlockDirtSalpeter extends FallingBlock {
public BlockDirtSalpeter(Identifier identifier) {
super(AbstractBlock.Settings.create().hardness(3.1f).registryKey(RegistryKey.of(RegistryKeys.BLOCK, identifier)));
}
@Override
public List<ItemStack> getDroppedStacks(BlockState blockState, Builder builder) {
Integer count = (Double.valueOf(new Random().nextDouble() * 10).intValue() / 4) + 1;
boolean spawnBoneMeal = new Random().nextDouble() > 0.5f;
ItemStack boneMealStack = new ItemStack(Items.BONE_MEAL);
ItemStack salpeterStack = new ItemStack(ModItems.ITEM_SALPETER, count);
ItemStack dirtStack = new ItemStack(Blocks.DIRT);
ItemStack[] spawnies = spawnBoneMeal ? new ItemStack[] { boneMealStack, salpeterStack, dirtStack }
: new ItemStack[] { salpeterStack, dirtStack };
return Arrays.asList(spawnies);
}
@Override
protected MapCodec<? extends FallingBlock> getCodec() {
return null;
}
}

View File

@@ -0,0 +1,135 @@
package de.jottyfan.quickiemod.block;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
import java.util.Set;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.ExperienceOrbEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootWorldContext.Builder;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.tick.OrderedTick;
/**
*
* @author jotty
*
*/
public class BlockEmptyLavahoarder extends Block {
public BlockEmptyLavahoarder(Identifier identifier) {
super(AbstractBlock.Settings.create().hardness(2.5f).registryKey(RegistryKey.of(RegistryKeys.BLOCK, identifier)));
}
@Override
public List<ItemStack> getDroppedStacks(BlockState state, Builder builder) {
List<ItemStack> list = new ArrayList<>();
list.add(new ItemStack(ModBlocks.BLOCK_EMPTYLAVAHOARDER));
return list;
}
@Override
protected void scheduledTick(BlockState state, ServerWorld world, BlockPos pos,
net.minecraft.util.math.random.Random random) {
boolean found = BlockLavahoarder.suckLava(world, pos.north());
found = found || BlockLavahoarder.suckLava(world, pos.south());
found = found || BlockLavahoarder.suckLava(world, pos.east());
found = found || BlockLavahoarder.suckLava(world, pos.west());
found = found || BlockLavahoarder.suckLava(world, pos.up());
found = found || BlockLavahoarder.suckLava(world, pos.down());
if (found) {
world.setBlockState(pos, ModBlocks.BLOCK_LAVAHOARDER.getDefaultState());
world.getBlockTickScheduler().scheduleTick(OrderedTick.create(ModBlocks.BLOCK_LAVAHOARDER, pos));
} else {
world.getBlockTickScheduler().scheduleTick(OrderedTick.create(this, pos));
}
}
private static final String stringOf(BlockPos pos) {
StringBuilder buf = new StringBuilder();
buf.append(pos.getX()).append(":");
buf.append(pos.getY()).append(":");
buf.append(pos.getZ());
return buf.toString();
}
private static final BlockPos blockPosOf(String s) {
if (s.contains(":")) {
String[] parts = s.split(":");
if (parts.length > 2) {
Integer x = Integer.valueOf(parts[0]);
Integer y = Integer.valueOf(parts[1]);
Integer z = Integer.valueOf(parts[2]);
return new BlockPos(x, y, z);
} else {
return null;
}
} else {
return null;
}
}
private void findAllAttachedLavaBlocks(Set<String> list, BlockPos pos, World world, Integer counter) {
if (counter < 1) {
return;
} else if (Blocks.LAVA.equals(world.getBlockState(pos).getBlock())) {
String p = stringOf(pos);
if (!list.contains(p)) {
list.add(p);
findAllAttachedLavaBlocks(list, pos.up(), world, counter - 1);
findAllAttachedLavaBlocks(list, pos.down(), world, counter - 1);
findAllAttachedLavaBlocks(list, pos.north(), world, counter - 1);
findAllAttachedLavaBlocks(list, pos.south(), world, counter - 1);
findAllAttachedLavaBlocks(list, pos.east(), world, counter - 1);
findAllAttachedLavaBlocks(list, pos.west(), world, counter - 1);
}
}
}
@Override
public void onPlaced(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) {
Set<String> positions = new HashSet<>();
Integer counter = 8; // TODO: make it level up - able
findAllAttachedLavaBlocks(positions, pos.up(), world, counter);
findAllAttachedLavaBlocks(positions, pos.down(), world, counter);
findAllAttachedLavaBlocks(positions, pos.north(), world, counter);
findAllAttachedLavaBlocks(positions, pos.south(), world, counter);
findAllAttachedLavaBlocks(positions, pos.east(), world, counter);
findAllAttachedLavaBlocks(positions, pos.west(), world, counter);
Integer amount = positions.size();
for (String p : positions) {
world.setBlockState(blockPosOf(p), Blocks.AIR.getDefaultState());
}
if (amount > 0) {
world.setBlockState(pos, ModBlocks.BLOCK_LAVAHOARDER.getDefaultState());
world.getBlockTickScheduler().scheduleTick(OrderedTick.create(ModBlocks.BLOCK_LAVAHOARDER, pos));
int count = 0;
Random random = new Random();
for (int i = 0; i < amount; i++) {
if (random.nextFloat() < 0.0125) {
count++;
}
}
BlockPos up = pos.up();
if (count > 0) {
BlockLavahoarder.spawnRandomItems(world, up, count);
world.spawnEntity(new ExperienceOrbEntity(world, (double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D,
(double) pos.getZ() + 0.5D, count));
}
} else {
world.getBlockTickScheduler().scheduleTick(OrderedTick.create(this, pos));
}
}
}

View File

@@ -0,0 +1,95 @@
package de.jottyfan.quickiemod.block;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import de.jottyfan.quickiemod.blockentity.ItemHoarderBlockEntity;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockEntityProvider;
import net.minecraft.block.BlockRenderType;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityTicker;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootWorldContext.Builder;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.text.Style;
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier;
import net.minecraft.util.ItemScatterer;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
/**
*
* @author jotty
*
*/
public class BlockItemhoarder extends Block implements BlockEntityProvider {
public BlockItemhoarder(Identifier identifier) {
super(AbstractBlock.Settings.create().hardness(2.5f).registryKey(RegistryKey.of(RegistryKeys.BLOCK, identifier)));
}
@Override
public BlockEntity createBlockEntity(BlockPos pos, BlockState blockState) {
return new ItemHoarderBlockEntity(pos, blockState);
}
@Override
public BlockRenderType getRenderType(BlockState state) {
return BlockRenderType.MODEL;
}
@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state,
BlockEntityType<T> type) {
return (world1, pos, state1, be) -> ItemHoarderBlockEntity.tick(world1, pos, state1, be);
}
@Override
public List<ItemStack> getDroppedStacks(BlockState state, Builder builder) {
List<ItemStack> list = new ArrayList<>();
list.add(new ItemStack(ModBlocks.BLOCK_ITEMHOARDER));
return list;
}
@Override
public BlockState onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) {
BlockEntity blockEntity = world.getBlockEntity(pos);
if (blockEntity instanceof ItemHoarderBlockEntity) {
ItemHoarderBlockEntity ihbe = (ItemHoarderBlockEntity) blockEntity;
for (ItemStack stack : ihbe.getStacks()) {
ItemScatterer.spawn(world, pos.getX(), pos.getY(), pos.getZ(), stack);
}
}
return super.onBreak(world, pos, state, player);
}
@Override
protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) {
if (!world.isClient) {
BlockEntity blockEntity = world.getBlockEntity(pos);
if (blockEntity instanceof ItemHoarderBlockEntity) {
ItemHoarderBlockEntity ihbe = (ItemHoarderBlockEntity) blockEntity;
player.sendMessage(
Text.translatable("msg.itemhoarder.summary", new SimpleDateFormat("dd.MM.yyyy HH:mm:ss").format(new Date()))
.setStyle(Style.EMPTY.withColor(Formatting.BOLD)),
false);
for (Text text : ihbe.getSummary()) {
player.sendMessage(text, false);
}
}
}
return ActionResult.SUCCESS;
}
}

View File

@@ -0,0 +1,135 @@
package de.jottyfan.quickiemod.block;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import de.jottyfan.quickiemod.item.ModItems;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.ItemEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.loot.context.LootWorldContext.Builder;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.Identifier;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.tick.OrderedTick;
/**
*
* @author jotty
*
*/
public class BlockLavahoarder extends Block {
public BlockLavahoarder(Identifier identifier) {
super(AbstractBlock.Settings.create().hardness(2.5f).luminance(state -> 15)
.registryKey(RegistryKey.of(RegistryKeys.BLOCK, identifier)));
}
@Override
public List<ItemStack> getDroppedStacks(BlockState state, Builder builder) {
List<ItemStack> list = new ArrayList<>();
list.add(new ItemStack(ModBlocks.BLOCK_LAVAHOARDER));
return list;
}
public static final void spawnRandomItems(World world, BlockPos pos, Integer count) {
Integer which = new Random().nextInt(10);
if (which < 1) {
world.spawnEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(),
new ItemStack(Items.DIAMOND, new Random().nextInt(count + 2))));
} else if (which < 2) {
world.spawnEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(),
new ItemStack(Items.EMERALD, new Random().nextInt(count + 1))));
} else if (which < 3) {
world.spawnEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(),
new ItemStack(Items.RAW_GOLD, new Random().nextInt(count))));
} else if (which < 4) {
world.spawnEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(),
new ItemStack(Items.RAW_IRON, new Random().nextInt(count + 1))));
} else if (which < 5) {
world.spawnEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(),
new ItemStack(Items.RAW_COPPER, new Random().nextInt(count + 2))));
} else if (which < 6) {
world.spawnEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(Items.OBSIDIAN)));
} else if (which < 7) {
world.spawnEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(Items.LAPIS_LAZULI)));
} else if (which < 8) {
world.spawnEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(ModItems.ITEM_SULFOR)));
}
}
/**
* sucks the lava that touches the block
*
* @param world the world
* @param pos the pos
* @return true if lava was found
*/
public static final boolean suckLava(World world, BlockPos pos) {
if (world == null) {
return false;
} else if (Blocks.LAVA.equals(world.getBlockState(pos).getBlock())) {
world.setBlockState(pos, Blocks.AIR.getDefaultState());
BlockPos up = pos.up();
Random random = new Random();
if (random.nextFloat() > 0.9f) {
spawnRandomItems(world, up, 2);
}
return true;
}
return false;
}
@Override
protected void scheduledTick(BlockState state, ServerWorld world, BlockPos pos,
net.minecraft.util.math.random.Random random) {
suckLava(world, pos.north());
suckLava(world, pos.south());
suckLava(world, pos.east());
suckLava(world, pos.west());
suckLava(world, pos.up());
suckLava(world, pos.down());
world.getBlockTickScheduler().scheduleTick(OrderedTick.create(this, pos));
}
@Override
protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) {
if (!world.isClient) {
Hand hand = player.getActiveHand();
ItemStack handStack = player.getStackInHand(hand);
if (handStack != null && Items.BUCKET.equals(handStack.getItem())) {
Integer amount = handStack.getCount();
ItemStack lavaBucketStack = new ItemStack(Items.LAVA_BUCKET, 1);
ItemStack emptyBucketStack = new ItemStack(Items.BUCKET, amount - 1);
if (emptyBucketStack.getCount() < 1) {
player.setStackInHand(hand, lavaBucketStack);
} else {
player.setStackInHand(hand, emptyBucketStack);
world.spawnEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), lavaBucketStack));
}
spawnRandomItems(world, pos, 2);
world.setBlockState(pos, ModBlocks.BLOCK_EMPTYLAVAHOARDER.getDefaultState());
world.getBlockTickScheduler().scheduleTick(OrderedTick.create(ModBlocks.BLOCK_EMPTYLAVAHOARDER, pos));
}
}
return ActionResult.SUCCESS; // forbid to empty the just filled lava bucket
}
@Override
public void onPlaced(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) {
world.getBlockTickScheduler().scheduleTick(OrderedTick.create(this, pos));
}
}

View File

@@ -0,0 +1,89 @@
package de.jottyfan.quickiemod.block;
import java.util.List;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.mob.HostileEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.state.StateManager.Builder;
import net.minecraft.state.property.IntProperty;
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Identifier;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.random.Random;
import net.minecraft.world.World;
import net.minecraft.world.tick.OrderedTick;
/**
*
* @author jotty
*
*/
public class BlockMonsterhoarder extends Block {
private static final IntProperty SUCKRADIUS = IntProperty.of("suckradius", 1, 15);
public BlockMonsterhoarder(Identifier identifier) {
super(AbstractBlock.Settings.create().hardness(2.5f).luminance(state -> state.get(BlockMonsterhoarder.SUCKRADIUS))
.registryKey(RegistryKey.of(RegistryKeys.BLOCK, identifier)));
setDefaultState(getDefaultState().with(SUCKRADIUS, 8));
}
@Override
protected void appendProperties(Builder<Block, BlockState> builder) {
builder.add(SUCKRADIUS);
super.appendProperties(builder);
}
@Override
protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) {
if (!world.isClient()) {
world.setBlockState(pos, state.cycle(SUCKRADIUS));
} else {
player.sendMessage(Text.translatable("msg.monsterhoarder.size", state.get(SUCKRADIUS)), false);
}
return ActionResult.SUCCESS;
}
@Override
protected void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
if (!world.isClient) {
Box box = new Box(pos).expand(Double.valueOf(state.get(SUCKRADIUS)));
List<Entity> entities = world.getOtherEntities(null, box);
for (Entity entity : entities) {
if (entity instanceof HostileEntity hostile) {
if (hostile.isFireImmune()) {
if (world instanceof ServerWorld serverWorld) {
hostile.kill(serverWorld);
}
} else {
hostile.setOnFireFor(90);
}
}
}
}
world.getBlockTickScheduler().scheduleTick(OrderedTick.create(this, pos));
}
@Override
public void onPlaced(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) {
if (!world.isClient) {
world.getBlockTickScheduler().scheduleTick(OrderedTick.create(this, pos));
world.playSound(null, pos, SoundEvents.UI_TOAST_CHALLENGE_COMPLETE, SoundCategory.PLAYERS, 1f, 1f);
}
super.onPlaced(world, pos, state, placer, itemStack);
}
}

View File

@@ -0,0 +1,33 @@
package de.jottyfan.quickiemod.block;
import java.util.Arrays;
import java.util.List;
import de.jottyfan.quickiemod.block.help.IntProviderHelper;
import de.jottyfan.quickiemod.item.ModItems;
import net.minecraft.block.BlockState;
import net.minecraft.block.ExperienceDroppingBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootWorldContext.Builder;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.Identifier;
/**
*
* @author jotty
*
*/
public class BlockOreDeepslateSulphor extends ExperienceDroppingBlock {
public BlockOreDeepslateSulphor(Identifier identifier) {
super(IntProviderHelper.of(0, 2), Settings.create().strength(2.5f).hardness(1.9f).sounds(BlockSoundGroup.SOUL_SAND)
.requiresTool().registryKey(RegistryKey.of(RegistryKeys.BLOCK, identifier)));
}
@Override
public List<ItemStack> getDroppedStacks(BlockState state, Builder builder) {
return Arrays.asList(new ItemStack[] { new ItemStack(ModItems.ITEM_SULFOR, 4) });
}
}

View File

@@ -0,0 +1,33 @@
package de.jottyfan.quickiemod.block;
import java.util.Arrays;
import java.util.List;
import de.jottyfan.quickiemod.block.help.IntProviderHelper;
import de.jottyfan.quickiemod.item.ModItems;
import net.minecraft.block.BlockState;
import net.minecraft.block.ExperienceDroppingBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootWorldContext.Builder;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.Identifier;
/**
*
* @author jotty
*
*/
public class BlockOreNetherSulphor extends ExperienceDroppingBlock {
public BlockOreNetherSulphor(Identifier identifier) {
super(IntProviderHelper.of(0, 2), Settings.create().strength(2.5f).hardness(2.1f).sounds(BlockSoundGroup.SOUL_SAND)
.requiresTool().registryKey(RegistryKey.of(RegistryKeys.BLOCK, identifier)));
}
@Override
public List<ItemStack> getDroppedStacks(BlockState state, Builder builder) {
return Arrays.asList(new ItemStack[] { new ItemStack(ModItems.ITEM_SULFOR) });
}
}

View File

@@ -0,0 +1,34 @@
package de.jottyfan.quickiemod.block;
import java.util.Arrays;
import java.util.List;
import de.jottyfan.quickiemod.block.help.IntProviderHelper;
import de.jottyfan.quickiemod.item.ModItems;
import net.minecraft.block.BlockState;
import net.minecraft.block.ExperienceDroppingBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootWorldContext.Builder;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.random.Random;
/**
*
* @author jotty
*
*/
public class BlockOreSalpeter extends ExperienceDroppingBlock {
public BlockOreSalpeter(Identifier identifier) {
super(IntProviderHelper.of(0, 2), Settings.create().strength(2.5f).hardness(3.1f).sounds(BlockSoundGroup.SOUL_SAND)
.requiresTool().registryKey(RegistryKey.of(RegistryKeys.BLOCK, identifier)));
}
@Override
public List<ItemStack> getDroppedStacks(BlockState state, Builder builder) {
return Arrays.asList(new ItemStack[] { new ItemStack(ModItems.ITEM_SALPETER, 2 + Random.create().nextInt(3)) });
}
}

View File

@@ -0,0 +1,34 @@
package de.jottyfan.quickiemod.block;
import java.util.Arrays;
import java.util.List;
import de.jottyfan.quickiemod.block.help.IntProviderHelper;
import de.jottyfan.quickiemod.item.ModItems;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.ExperienceDroppingBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootWorldContext.Builder;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.random.Random;
/**
*
* @author jotty
*
*/
public class BlockOreSandSalpeter extends ExperienceDroppingBlock {
public BlockOreSandSalpeter(Identifier identifier) {
super(IntProviderHelper.of(0, 2), Settings.create().strength(2.5f).hardness(2.9f).sounds(BlockSoundGroup.SOUL_SAND).requiresTool().registryKey(RegistryKey.of(RegistryKeys.BLOCK, identifier)));
}
@Override
public List<ItemStack> getDroppedStacks(BlockState state, Builder builder) {
return Arrays.asList(new ItemStack[] { new ItemStack(ModItems.ITEM_SALPETER, 7 + Random.create().nextInt(4)), new ItemStack(Blocks.SAND) });
}
}

View File

@@ -0,0 +1,33 @@
package de.jottyfan.quickiemod.block;
import java.util.Arrays;
import java.util.List;
import de.jottyfan.quickiemod.block.help.IntProviderHelper;
import de.jottyfan.quickiemod.item.ModItems;
import net.minecraft.block.BlockState;
import net.minecraft.block.ExperienceDroppingBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootWorldContext.Builder;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.Identifier;
/**
*
* @author jotty
*
*/
public class BlockOreSulphor extends ExperienceDroppingBlock {
public BlockOreSulphor(Identifier identifier) {
super(IntProviderHelper.of(0, 2), Settings.create().strength(2.5f).hardness(1.9f).sounds(BlockSoundGroup.SOUL_SAND)
.requiresTool().registryKey(RegistryKey.of(RegistryKeys.BLOCK, identifier)));
}
@Override
public List<ItemStack> getDroppedStacks(BlockState state, Builder builder) {
return Arrays.asList(new ItemStack[] { new ItemStack(ModItems.ITEM_SULFOR) });
}
}

View File

@@ -0,0 +1,79 @@
package de.jottyfan.quickiemod.block;
import java.util.List;
import java.util.Random;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.CropBlock;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemConvertible;
import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootWorldContext.Builder;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Identifier;
import net.minecraft.util.ItemScatterer;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
/**
*
* @author jotty
*
*/
public class BlockPlant extends CropBlock {
private Item seed;
private Item fruit;
public BlockPlant(Identifier identifier, Item seed, Item fruit) {
super(AbstractBlock.Settings.copy(Blocks.WHEAT).registryKey(RegistryKey.of(RegistryKeys.BLOCK, identifier)));
this.seed = seed;
this.fruit = fruit;
}
@Override
public List<ItemStack> getDroppedStacks(BlockState state, Builder builder) {
DefaultedList<ItemStack> list = DefaultedList.of();
list.add(new ItemStack(getSeedsItem())); // the one from the seed
if (isMature(state)) {
list.add(new ItemStack(getSeedsItem(), new Random().nextInt(2)));
list.add(new ItemStack(fruit, new Random().nextFloat() > 0.9f ? 2 : 1));
}
return list;
}
private void spawnHarvested(World world, BlockPos pos, BlockState state) {
DefaultedList<ItemStack> list = DefaultedList.of();
getDroppedStacks(state, null).forEach(itemStack -> {
list.add(itemStack);
});
ItemScatterer.spawn(world, pos, list);
}
@Override
public BlockState onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) {
spawnHarvested(world, pos, state);
return super.onBreak(world, pos, state, player);
}
@Override
protected ItemConvertible getSeedsItem() {
return seed;
}
@Override
protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) {
if (!world.isClient && isMature(state)) {
spawnHarvested(world, pos, state);
world.setBlockState(pos, state.with(AGE, 0));
}
return ActionResult.PASS;
}
}

View File

@@ -0,0 +1,43 @@
package de.jottyfan.quickiemod.block;
import java.util.Arrays;
import java.util.List;
import com.mojang.serialization.MapCodec;
import de.jottyfan.quickiemod.item.ModItems;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.FallingBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootWorldContext.Builder;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.random.Random;
/**
*
* @author jotty
*
*/
public class BlockSandSalpeter extends FallingBlock {
public BlockSandSalpeter(Identifier identifier) {
super(Settings.create().strength(2.5f).hardness(3.1f).sounds(BlockSoundGroup.SOUL_SAND).requiresTool()
.registryKey(RegistryKey.of(RegistryKeys.BLOCK, identifier)));
}
@Override
public List<ItemStack> getDroppedStacks(BlockState state, Builder builder) {
return Arrays.asList(new ItemStack[] { new ItemStack(ModItems.ITEM_SALPETER, 3 + Random.create().nextInt(2)),
new ItemStack(Blocks.SAND) });
}
@Override
protected MapCodec<? extends FallingBlock> getCodec() {
// TODO Auto-generated method stub
return null;
}
}

View File

@@ -0,0 +1,22 @@
package de.jottyfan.quickiemod.block;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.Identifier;
/**
*
* @author jotty
*
*/
public class BlockSlippery extends Block {
public BlockSlippery(Identifier identifier, float hardness, float slipperiness, BlockSoundGroup soundGroup) {
super(AbstractBlock.Settings.create().hardness(hardness).slipperiness(slipperiness).breakInstantly()
.sounds(soundGroup).registryKey(RegistryKey.of(RegistryKeys.BLOCK, identifier)));
}
}

View File

@@ -14,6 +14,7 @@ import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.Identifier;
/**
@@ -27,10 +28,48 @@ public class ModBlocks {
ModIdentifiers.BLOCK_QUICKIEPOWDER, new ItemStack[] { new ItemStack(ModItems.ITEM_QUICKIEPOWDER, 9) }));
public static final Block BLOCK_SPEEDPOWDER = registerBlock(ModIdentifiers.BLOCK_SPEEDPOWDER, new BlockPowder(
ModIdentifiers.BLOCK_SPEEDPOWDER, new ItemStack[] { new ItemStack(ModItems.ITEM_SPEEDPOWDER, 9) }));
public static final Block BLOCK_SALPETER = registerBlock(ModIdentifiers.BLOCK_SALPETER, new BlockBreakByTool(
ModIdentifiers.BLOCK_SALPETER, 1.5f, 1.5f, new ItemStack[] { new ItemStack(ModItems.ITEM_SALPETER, 9) }));
public static final Block BLOCK_SULFOR = registerBlock(ModIdentifiers.BLOCK_SULFOR, new BlockBreakByTool(
ModIdentifiers.BLOCK_SULFOR, 1.5f, 1.5f, new ItemStack[] { new ItemStack(ModItems.ITEM_SULFOR, 9) }));
public static final Block BLOCK_MONSTERHOARDER = registerBlock(ModIdentifiers.BLOCK_MONSTERHOARDER,
new BlockMonsterhoarder(ModIdentifiers.BLOCK_MONSTERHOARDER));
public static final Block BLOCK_LAVAHOARDER = registerBlock(ModIdentifiers.BLOCK_LAVAHOARDER,
new BlockLavahoarder(ModIdentifiers.BLOCK_LAVAHOARDER));
public static final Block BLOCK_EMPTYLAVAHOARDER = registerBlock(ModIdentifiers.BLOCK_EMPTYLAVAHOARDER,
new BlockEmptyLavahoarder(ModIdentifiers.BLOCK_EMPTYLAVAHOARDER));
public static final Block BLOCK_ITEMHOARDER = registerBlock(ModIdentifiers.BLOCK_ITEMHOARDER,
new BlockItemhoarder(ModIdentifiers.BLOCK_ITEMHOARDER));
public static final Block BLOCK_DIRTSALPETER = registerBlock(ModIdentifiers.BLOCK_DIRTSALPETER,
new BlockDirtSalpeter(ModIdentifiers.BLOCK_DIRTSALPETER));
public static final Block BLOCK_OREDEEPSLATESULFOR = registerBlock(ModIdentifiers.BLOCK_OREDEEPSLATESULFOR,
new BlockOreDeepslateSulphor(ModIdentifiers.BLOCK_OREDEEPSLATESULFOR));
public static final Block BLOCK_ORENETHERSULFOR = registerBlock(ModIdentifiers.BLOCK_ORENETHERSULFOR,
new BlockOreNetherSulphor(ModIdentifiers.BLOCK_ORENETHERSULFOR));
public static final Block BLOCK_ORESALPETER = registerBlock(ModIdentifiers.BLOCK_ORESALPETER,
new BlockOreSalpeter(ModIdentifiers.BLOCK_ORESALPETER));
public static final Block BLOCK_ORESANDSALPETER = registerBlock(ModIdentifiers.BLOCK_ORESANDSALPETER,
new BlockOreSandSalpeter(ModIdentifiers.BLOCK_ORESANDSALPETER));
public static final Block BLOCK_ORESULFOR = registerBlock(ModIdentifiers.BLOCK_ORESULFOR,
new BlockOreSulphor(ModIdentifiers.BLOCK_ORESULFOR));
public static final Block BLOCK_SANDSALPETER = registerBlock(ModIdentifiers.BLOCK_SANDSALPETER,
new BlockSandSalpeter(ModIdentifiers.BLOCK_SANDSALPETER));
public static final Block BLOCK_KELPSTACK = registerBlock(ModIdentifiers.BLOCK_KELPSTACK,
new BlockSlippery(ModIdentifiers.BLOCK_KELPSTACK, 0.1f, 1.0f, BlockSoundGroup.WET_GRASS));
public static final Block BLOCK_COTTONPLANT = registerBlock(ModIdentifiers.BLOCK_COTTONPLANT,
new BlockPlant(ModIdentifiers.BLOCK_COTTONPLANT, ModItems.ITEM_COTTONSEED, ModItems.ITEM_COTTON), false);
public static final Block BLOCK_CANOLAPLANT = registerBlock(ModIdentifiers.BLOCK_CANOLAPLANT,
new BlockPlant(ModIdentifiers.BLOCK_CANOLAPLANT, ModItems.ITEM_CANOLASEED, ModItems.ITEM_CANOLA), false);
private static final Block registerBlock(Identifier identifier, Block block) {
return registerBlock(identifier, block, true);
}
private static final Block registerBlock(Identifier identifier, Block block, boolean registerAsItem) {
if (registerAsItem) {
Registry.register(Registries.ITEM, identifier, new BlockItem(block, new Item.Settings()
.registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier)).useBlockPrefixedTranslationKey()));
}
return Registry.register(Registries.BLOCK, identifier, block);
}
@@ -40,6 +79,20 @@ public class ModBlocks {
List<Block> blocks = new ArrayList<>();
blocks.add(BLOCK_QUICKIEPOWDER);
blocks.add(BLOCK_SPEEDPOWDER);
blocks.add(BLOCK_SALPETER);
blocks.add(BLOCK_SULFOR);
blocks.add(BLOCK_MONSTERHOARDER);
blocks.add(BLOCK_EMPTYLAVAHOARDER);
blocks.add(BLOCK_LAVAHOARDER);
blocks.add(BLOCK_ITEMHOARDER);
blocks.add(BLOCK_DIRTSALPETER);
blocks.add(BLOCK_OREDEEPSLATESULFOR);
blocks.add(BLOCK_ORENETHERSULFOR);
blocks.add(BLOCK_ORESALPETER);
blocks.add(BLOCK_ORESANDSALPETER);
blocks.add(BLOCK_ORESULFOR);
blocks.add(BLOCK_SANDSALPETER);
blocks.add(BLOCK_KELPSTACK);
return blocks;
}
}

View File

@@ -0,0 +1,37 @@
package de.jottyfan.quickiemod.block.help;
import net.minecraft.util.math.intprovider.IntProvider;
import net.minecraft.util.math.intprovider.IntProviderType;
import net.minecraft.util.math.random.Random;
/**
*
* @author jotty
*
*/
public class IntProviderHelper {
public static final IntProvider of(Integer min, Integer max) {
return new IntProvider() {
@Override
public IntProviderType<?> getType() {
return IntProviderType.CONSTANT;
}
@Override
public int getMin() {
return min;
}
@Override
public int getMax() {
return max;
}
@Override
public int get(Random random) {
return random.nextBetween(min, max);
}
};
}
}

View File

@@ -0,0 +1,154 @@
package de.jottyfan.quickiemod.blockentity;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.LootableContainerBlockEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.Entity.RemovalReason;
import net.minecraft.entity.ItemEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Inventories;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.registry.RegistryWrapper.WrapperLookup;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.text.Text;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.world.World;
/**
*
* @author jotty
*
*/
public class ItemHoarderBlockEntity extends LootableContainerBlockEntity {
private DefaultedList<ItemStack> stacks;
private float suckradius;
public ItemHoarderBlockEntity(BlockPos pos, BlockState state) {
super(ModBlockentity.ITEM_HOARDER_BLOCKENTITY, pos, state);
stacks = DefaultedList.ofSize(54, ItemStack.EMPTY);
setSuckradius(4f);
}
// TODO: see https://fabricmc.net/wiki/tutorial:containers for a real chest
public final static boolean setStackToSlots(ItemStack stack, List<ItemStack> stacks) {
for (ItemStack slot : stacks) {
if (slot.getItem().equals(stack.getItem())) {
slot.increment(stack.getCount());
return true;
}
} // if not found, seek for an empty stack instead
for (ItemStack slot : stacks) {
if (slot.isEmpty()) {
Integer index = stacks.indexOf(slot);
stacks.set(index, stack.copy());
return true;
}
}
return false;
}
public static void tick(World world, BlockPos pos, BlockState state, BlockEntity be) {
if (be instanceof ItemHoarderBlockEntity) {
ItemHoarderBlockEntity ihbe = (ItemHoarderBlockEntity) be;
Box box = new Box(pos).expand(ihbe.getSuckradius());
List<Entity> entities = world.getOtherEntities(null, box);
for (Entity entity : entities) {
if (entity instanceof ItemEntity) {
ItemEntity itemEntity = (ItemEntity) entity;
if (itemEntity.isAlive()) {
ItemStack stack = itemEntity.getStack();
if (stack != null) {
if (ItemHoarderBlockEntity.setStackToSlots(stack, ihbe.getStacks())) {
itemEntity.remove(RemovalReason.DISCARDED);
} // else inventory is full
}
}
}
}
}
}
@Override
protected void writeNbt(NbtCompound nbt, WrapperLookup registryLookup) {
super.writeNbt(nbt, registryLookup);
if (!this.writeLootTable(nbt)) {
Inventories.writeNbt(nbt, this.stacks, registryLookup);
}
}
@Override
protected void readNbt(NbtCompound nbt, WrapperLookup registryLookup) {
super.readNbt(nbt, registryLookup);
this.stacks = DefaultedList.ofSize(this.size(), ItemStack.EMPTY);
if (!this.readLootTable(nbt)) {
Inventories.readNbt(nbt, this.stacks, registryLookup);
}
}
public List<ItemStack> getStacks() {
return stacks;
}
@Override
public int size() {
return 54; // container chest size (9 * 6)
}
@Override
protected DefaultedList<ItemStack> getHeldStacks() {
return stacks;
}
@Override
protected void setHeldStacks(DefaultedList<ItemStack> list) {
this.stacks = list;
}
@Override
protected ScreenHandler createScreenHandler(int syncId, PlayerInventory playerInventory) {
// TODO: implement, see https://fabricmc.net/wiki/tutorial:containers
return null;
}
@Override
protected Text getContainerName() {
return Text.translatable("container.itemhoarder");
}
/**
* get a summary of content for the chat box
*
* @return the summary
*/
public List<Text> getSummary() {
List<Text> list = new ArrayList<>();
for (ItemStack stack : stacks) {
Item item = stack.getItem();
if (item != Items.AIR) {
Text text = Text.of(String.format("%dx %s", stack.getCount(), Text.translatable(stack.getItem().getTranslationKey())));
list.add(text);
}
}
return list;
}
public float getSuckradius() {
return suckradius;
}
public void setSuckradius(float suckradius) {
this.suckradius = suckradius;
}
}

View File

@@ -0,0 +1,22 @@
package de.jottyfan.quickiemod.blockentity;
import de.jottyfan.quickiemod.block.ModBlocks;
import de.jottyfan.quickiemod.identifier.ModIdentifiers;
import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
/**
*
* @author jotty
*
*/
public class ModBlockentity {
public static final BlockEntityType<ItemHoarderBlockEntity> ITEM_HOARDER_BLOCKENTITY = Registry.register(
Registries.BLOCK_ENTITY_TYPE, ModIdentifiers.BLOCKENTITY_ITEMHOARDER,
FabricBlockEntityTypeBuilder.create(ItemHoarderBlockEntity::new, ModBlocks.BLOCK_ITEMHOARDER).build());
public static final void registerModBlockentities() {
};
}

View File

@@ -0,0 +1,192 @@
package de.jottyfan.quickiemod.event;
import java.util.ArrayList;
import java.util.List;
import de.jottyfan.quickiemod.item.HarvestRange;
import de.jottyfan.quickiemod.item.ModItems;
import de.jottyfan.quickiemod.item.ToolRangeable;
import de.jottyfan.quickiemod.item.ToolSpeedpowderAxe;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.ExperienceOrbEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
/**
*
* @author jotty
*
*/
public class EventBlockBreak {
private enum BlockBreakDirection {
UPWARDS, ALL;
}
public void doBreakBlock(World world, BlockPos blockPos, BlockState blockState, PlayerEntity playerEntity, Block oldBlock) {
ItemStack mainHandItemStack = playerEntity.getEquippedStack(EquipmentSlot.MAINHAND);
if (mainHandItemStack != null) {
Item item = mainHandItemStack.getItem();
if (item instanceof ToolRangeable) {
ToolRangeable tool = (ToolRangeable) item;
if (!world.getBlockState(blockPos).getBlock().equals(oldBlock)) {
// recreate old block to make it breakable; otherwise, the recursive algorithm stops directly
world.setBlockState(blockPos, oldBlock.getDefaultState());
}
int handled = handleRangeableTools(tool, mainHandItemStack, world, oldBlock, blockPos, playerEntity);
if (handled >= 255) {
// reward for using rangeable tool very successful
world.spawnEntity(
new ExperienceOrbEntity(world, blockPos.getX(), blockPos.getY(), blockPos.getZ(), handled / 255));
}
}
}
}
/**
* handle the rangeable tools break event
*
* @param tool the tool that has been used
* @param itemStack the item stack
* @param world the world
* @param block the block to break
* @param pos the position of the current block
* @param player the current player
* @return number of affected blocks
*/
private int handleRangeableTools(ToolRangeable tool, ItemStack itemStack, World world, Block currentBlock,
BlockPos pos, PlayerEntity player) {
List<Block> validBlocks = tool.getBlockList(currentBlock);
HarvestRange range = tool.getRange(itemStack);
List<String> visitedBlocks = new ArrayList<>();
if (tool instanceof ToolSpeedpowderAxe) {
return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.UPWARDS,
player, true);
} else if (ModItems.TOOL_SPEEDPOWDERPICKAXE.getName().equals(tool.getName())) {
return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL,
player, false);
} else if (ModItems.TOOL_SPEEDPOWDERSHOVEL.getName().equals(tool.getName())) {
return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL,
player, false);
} else if (ModItems.TOOL_SPEEDPOWDERHOE.getName().equals(tool.getName())) {
return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL,
player, false);
} else if (ModItems.TOOL_QUICKIEPOWDERAXE.getName().equals(tool.getName())) {
return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.UPWARDS,
player, true);
} else if (ModItems.TOOL_QUICKIEPOWDERPICKAXE.getName().equals(tool.getName())) {
return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL,
player, false);
} else if (ModItems.TOOL_QUICKIEPOWDERSHOVEL.getName().equals(tool.getName())) {
return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL,
player, false);
} else if (ModItems.TOOL_QUICKIEPOWDERHOE.getName().equals(tool.getName())) {
return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL,
player, false);
} else {
return 0;
}
}
/**
* break block recursively;
*
* @param visitedBlocks the positions of visited blocks
* @param world the world
* @param validBlocks the blocks to break
* @param tool the tool used
* @param range the range left over
* @param pos the position
* @param blockBreakDirection the direction for the recursive call
* @param player the player
* @return number of affected blocks
*/
private int breakBlockRecursive(List<String> visitedBlocks, World world, List<Block> validBlocks, BlockPos pos,
ToolRangeable tool, HarvestRange range, BlockBreakDirection blockBreakDirection, PlayerEntity player,
boolean breakLeaves) {
boolean ignoreSpawn = visitedBlocks.size() < 1; // with this, the already broken block can be omitted to spawn
if (visitedBlocks.contains(pos.toString())) {
return 0;
} else if (validBlocks == null) {
return 0;
} else {
visitedBlocks.add(pos.toString());
}
Integer affected = 0;
BlockState blockState = world.getBlockState(pos);
if (tool.canBreakNeighbors(blockState)) {
Block currentBlock = blockState.getBlock();
if (validBlocks.contains(currentBlock)) {
if (!ignoreSpawn) {
Block.dropStacks(blockState, world, pos); // includes xorbs
}
affected += 1;
world.setBlockState(pos, Blocks.AIR.getDefaultState());
if (range == null || range.getxRange() > 1 || range.getyRange() > 1 || range.getzRange() > 1) {
HarvestRange nextRadius = range == null ? null : range.addXYZ(-1);
affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.north(), tool, nextRadius,
blockBreakDirection, player, breakLeaves);
affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.north().east(), tool, nextRadius,
blockBreakDirection, player, breakLeaves);
affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.north().west(), tool, nextRadius,
blockBreakDirection, player, breakLeaves);
affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.south(), tool, nextRadius,
blockBreakDirection, player, breakLeaves);
affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.south().east(), tool, nextRadius,
blockBreakDirection, player, breakLeaves);
affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.south().west(), tool, nextRadius,
blockBreakDirection, player, breakLeaves);
affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.east(), tool, nextRadius,
blockBreakDirection, player, breakLeaves);
affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.west(), tool, nextRadius,
blockBreakDirection, player, breakLeaves);
affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.up(), tool, nextRadius,
blockBreakDirection, player, breakLeaves);
affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.up().north(), tool, nextRadius,
blockBreakDirection, player, breakLeaves);
affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.up().north().east(), tool, nextRadius,
blockBreakDirection, player, breakLeaves);
affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.up().north().west(), tool, nextRadius,
blockBreakDirection, player, breakLeaves);
affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.up().east(), tool, nextRadius,
blockBreakDirection, player, breakLeaves);
affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.up().west(), tool, nextRadius,
blockBreakDirection, player, breakLeaves);
affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.up().south().east(), tool, nextRadius,
blockBreakDirection, player, breakLeaves);
affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.up().south().west(), tool, nextRadius,
blockBreakDirection, player, breakLeaves);
affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.up().south(), tool, nextRadius,
blockBreakDirection, player, breakLeaves);
if (BlockBreakDirection.ALL.equals(blockBreakDirection)) {
affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.down(), tool, nextRadius,
blockBreakDirection, player, breakLeaves);
affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.down().north(), tool, nextRadius,
blockBreakDirection, player, breakLeaves);
affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.down().south(), tool, nextRadius,
blockBreakDirection, player, breakLeaves);
affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.down().east(), tool, nextRadius,
blockBreakDirection, player, breakLeaves);
affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.down().west(), tool, nextRadius,
blockBreakDirection, player, breakLeaves);
affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.down().north().east(), tool,
nextRadius, blockBreakDirection, player, breakLeaves);
affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.down().north().west(), tool,
nextRadius, blockBreakDirection, player, breakLeaves);
affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.down().south().east(), tool,
nextRadius, blockBreakDirection, player, breakLeaves);
affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.down().south().west(), tool,
nextRadius, blockBreakDirection, player, breakLeaves);
}
}
}
}
return affected;
}
}

View File

@@ -0,0 +1,66 @@
package de.jottyfan.quickiemod.feature;
import de.jottyfan.quickiemod.Quickiemod;
import net.fabricmc.fabric.api.biome.v1.BiomeModifications;
import net.fabricmc.fabric.api.biome.v1.BiomeSelectors;
import net.fabricmc.fabric.api.biome.v1.ModificationPhase;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.Identifier;
import net.minecraft.world.gen.GenerationStep;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.PlacedFeature;
/**
*
* @author jotty
*
*/
public class ModFeatures {
public static final RegistryKey<ConfiguredFeature<?, ?>> CF_ORESULFUR = genCf("oresulphor");
public static final RegistryKey<ConfiguredFeature<?, ?>> CF_OREDEEPSLATESULFUR = genCf("oredepslatesulphor");
public static final RegistryKey<ConfiguredFeature<?, ?>> CF_ORESALPETER = genCf("oresalpeter");
public static final RegistryKey<ConfiguredFeature<?, ?>> CF_ORENETHERSULPHOR = genCf("orenethersulphore");
public static final RegistryKey<ConfiguredFeature<?, ?>> CF_BLOCKSULPHOR = genCf("blocksulphor");
public static final RegistryKey<ConfiguredFeature<?, ?>> CF_DIRTSALPETER = genCf("dirtsalpeter");
public static final RegistryKey<ConfiguredFeature<?, ?>> CF_SANDSALPETER = genCf("sandsalpeter");
public static final RegistryKey<ConfiguredFeature<?, ?>> CF_ORESANDSALPETER = genCf("oresandsalpeter");
public static final RegistryKey<PlacedFeature> PF_ORESULPHOR = genPf("oresulphor");
public static final RegistryKey<PlacedFeature> PF_OREDEEPSLATESULPHOR = genPf("oredeepslatesulphor");
public static final RegistryKey<PlacedFeature> PF_ORESALPETER = genPf("oresalpeter");
public static final RegistryKey<PlacedFeature> PF_ORENETHERSULPHOR = genPf("orenethersulphor");
public static final RegistryKey<PlacedFeature> PF_BLOCKSULPHOR = genPf("blocksulphor");
public static final RegistryKey<PlacedFeature> PF_DIRTSALPETER = genPf("dirtsalpeter");
public static final RegistryKey<PlacedFeature> PF_SANDSALPETER = genPf("sandsalpeter");
public static final RegistryKey<PlacedFeature> PF_ORESANDSALPETER = genPf("oresandsalpeter");
private static final RegistryKey<ConfiguredFeature<?, ?>> genCf(String name) {
return RegistryKey.of(RegistryKeys.CONFIGURED_FEATURE, Identifier.of(Quickiemod.MOD_ID, name));
}
private static final RegistryKey<PlacedFeature> genPf(String name) {
return RegistryKey.of(RegistryKeys.PLACED_FEATURE, Identifier.of(Quickiemod.MOD_ID, name));
}
public static final void registerFeatures() {
// Overworld features
BiomeModifications.create(Identifier.of(Quickiemod.MOD_ID, "features")).add(ModificationPhase.ADDITIONS,
BiomeSelectors.foundInOverworld(), (bsc, bmc) -> {
bmc.getGenerationSettings().addFeature(GenerationStep.Feature.UNDERGROUND_ORES, PF_ORESULPHOR);
bmc.getGenerationSettings().addFeature(GenerationStep.Feature.UNDERGROUND_ORES, PF_ORESALPETER);
bmc.getGenerationSettings().addFeature(GenerationStep.Feature.UNDERGROUND_ORES, PF_DIRTSALPETER);
bmc.getGenerationSettings().addFeature(GenerationStep.Feature.UNDERGROUND_ORES, PF_SANDSALPETER);
bmc.getGenerationSettings().addFeature(GenerationStep.Feature.UNDERGROUND_ORES, PF_ORESANDSALPETER);
bmc.getGenerationSettings().addFeature(GenerationStep.Feature.UNDERGROUND_ORES, PF_OREDEEPSLATESULPHOR);
});
// Nether features
BiomeModifications.create(Identifier.of(Quickiemod.MOD_ID, "nether_features")).add(ModificationPhase.ADDITIONS,
BiomeSelectors.foundInTheNether(), (bsc, bmc) -> {
bmc.getGenerationSettings().addFeature(GenerationStep.Feature.UNDERGROUND_ORES, PF_ORENETHERSULPHOR);
bmc.getGenerationSettings().addFeature(GenerationStep.Feature.UNDERGROUND_ORES, PF_BLOCKSULPHOR);
});
}
}

View File

@@ -12,6 +12,53 @@ public class ModIdentifiers {
public static final Identifier ITEM_STUB = Identifier.of(Quickiemod.MOD_ID, "stub");
public static final Identifier ITEM_SPEEDPOWDER = Identifier.of(Quickiemod.MOD_ID, "speedpowder");
public static final Identifier ITEM_QUICKIEPOWDER = Identifier.of(Quickiemod.MOD_ID, "quickiepowder");
public static final Identifier ITEM_SALPETER = Identifier.of(Quickiemod.MOD_ID, "salpeter");
public static final Identifier ITEM_SULFOR = Identifier.of(Quickiemod.MOD_ID, "sulphor");
public static final Identifier ITEM_OXIDIZEDCOPPERPOWDER = Identifier.of(Quickiemod.MOD_ID, "oxidizedcopperpowder");
public static final Identifier ITEM_SPEEDINGOT = Identifier.of(Quickiemod.MOD_ID, "speedingot");
public static final Identifier ITEM_QUICKIEINGOT = Identifier.of(Quickiemod.MOD_ID, "quickieingot");
public static final Identifier ITEM_CARROTSTACK = Identifier.of(Quickiemod.MOD_ID, "carrotstack");
public static final Identifier ITEM_ROTTENFLESHSTRIPES = Identifier.of(Quickiemod.MOD_ID, "rotten_flesh_stripes");
public static final Identifier ITEM_COTTON = Identifier.of(Quickiemod.MOD_ID, "cotton");
public static final Identifier ITEM_COTTONPLANT = Identifier.of(Quickiemod.MOD_ID, "cottonplant");
public static final Identifier ITEM_COTTONSEED = Identifier.of(Quickiemod.MOD_ID, "cottonseed");
public static final Identifier ITEM_CANOLA = Identifier.of(Quickiemod.MOD_ID, "canola");
public static final Identifier ITEM_CANOLAPLANT = Identifier.of(Quickiemod.MOD_ID, "canolaplant");
public static final Identifier ITEM_CANOLASEED = Identifier.of(Quickiemod.MOD_ID, "canolaseed");
public static final Identifier ITEM_CANOLABOTTLE = Identifier.of(Quickiemod.MOD_ID, "canolabottle");
public static final Identifier ITEM_CANOLABOTTLESTACK = Identifier.of(Quickiemod.MOD_ID, "canolabottlestack");
public static final Identifier TOOL_SPEEDPOWDERAXE = Identifier.of(Quickiemod.MOD_ID, "speedpowderaxe");
public static final Identifier TOOL_SPEEDPOWDERHOE = Identifier.of(Quickiemod.MOD_ID, "speedpowderhoe");
public static final Identifier TOOL_SPEEDPOWDERPICKAXE = Identifier.of(Quickiemod.MOD_ID, "speedpowderpickaxe");
public static final Identifier TOOL_SPEEDPOWDERSHEARS = Identifier.of(Quickiemod.MOD_ID, "speedpowdershears");
public static final Identifier TOOL_SPEEDPOWDERSHOVEL = Identifier.of(Quickiemod.MOD_ID, "speedpowdershovel");
public static final Identifier TOOL_SPEEDPOWDERWATERHOE = Identifier.of(Quickiemod.MOD_ID, "speedpowderwaterhoe");
public static final Identifier TOOL_QUICKIEPOWDERAXE = Identifier.of(Quickiemod.MOD_ID, "quickiepowderaxe");
public static final Identifier TOOL_QUICKIEPOWDERHOE = Identifier.of(Quickiemod.MOD_ID, "quickiepowderhoe");
public static final Identifier TOOL_QUICKIEPOWDERPICKAXE = Identifier.of(Quickiemod.MOD_ID, "quickiepowderpickaxe");
public static final Identifier TOOL_QUICKIEPOWDERSHOVEL = Identifier.of(Quickiemod.MOD_ID, "quickiepowdershovel");
public static final Identifier TOOL_QUICKIEPOWDERWATERHOE = Identifier.of(Quickiemod.MOD_ID, "quickiepowderwaterhoe");
public static final Identifier BLOCK_QUICKIEPOWDER = Identifier.of(Quickiemod.MOD_ID, "blockquickiepowder");
public static final Identifier BLOCK_SPEEDPOWDER = Identifier.of(Quickiemod.MOD_ID, "blockspeedpowder");
public static final Identifier BLOCK_SALPETER = Identifier.of(Quickiemod.MOD_ID, "blocksalpeter");
public static final Identifier BLOCK_SULFOR = Identifier.of(Quickiemod.MOD_ID, "blocksulphor");
public static final Identifier BLOCK_MONSTERHOARDER = Identifier.of(Quickiemod.MOD_ID, "monsterhoarder");
public static final Identifier BLOCK_LAVAHOARDER = Identifier.of(Quickiemod.MOD_ID, "lavahoarder");
public static final Identifier BLOCK_EMPTYLAVAHOARDER = Identifier.of(Quickiemod.MOD_ID, "emptylavahoarder");
public static final Identifier BLOCK_ITEMHOARDER = Identifier.of(Quickiemod.MOD_ID, "itemhoarder");
public static final Identifier BLOCK_DIRTSALPETER = Identifier.of(Quickiemod.MOD_ID, "dirtsalpeter");
public static final Identifier BLOCK_OREDEEPSLATESULFOR = Identifier.of(Quickiemod.MOD_ID, "oredeepslatesulphor");
public static final Identifier BLOCK_ORENETHERSULFOR = Identifier.of(Quickiemod.MOD_ID, "orenethersulphor");
public static final Identifier BLOCK_ORESALPETER = Identifier.of(Quickiemod.MOD_ID, "oresalpeter");
public static final Identifier BLOCK_ORESANDSALPETER = Identifier.of(Quickiemod.MOD_ID, "oresandsalpeter");
public static final Identifier BLOCK_ORESULFOR = Identifier.of(Quickiemod.MOD_ID, "oresulphor");
public static final Identifier BLOCK_SANDSALPETER = Identifier.of(Quickiemod.MOD_ID, "sandsalpeter");
public static final Identifier BLOCK_KELPSTACK = Identifier.of(Quickiemod.MOD_ID, "kelpstack");
public static final Identifier BLOCK_COTTONPLANT = Identifier.of(Quickiemod.MOD_ID, "blockcottonplant");
public static final Identifier BLOCK_CANOLAPLANT = Identifier.of(Quickiemod.MOD_ID, "blockcanolaplant");
public static final Identifier BLOCKENTITY_ITEMHOARDER = Identifier.of(Quickiemod.MOD_ID, "itemhoarderblockentity");
public static final Identifier BLOCKENTITY_BLOCKSTACKER = Identifier.of(Quickiemod.MOD_ID, "blockstackerblockentity");
}

View File

@@ -0,0 +1,110 @@
package de.jottyfan.quickiemod.item;
import java.io.Serializable;
/**
*
* @author jotty
*
*/
public class HarvestRange implements Serializable {
private static final long serialVersionUID = 1L;
private int xRange;
private int yRange;
private int zRange;
public HarvestRange(int xyzRange) {
super();
this.xRange = xyzRange;
this.yRange = xyzRange;
this.zRange = xyzRange;
}
public HarvestRange(int[] xyzRange) {
super();
this.xRange = xyzRange[0];
this.yRange = xyzRange[1];
this.zRange = xyzRange[2];
}
public HarvestRange(int xRange, int yRange, int zRange) {
super();
this.xRange = xRange;
this.yRange = yRange;
this.zRange = zRange;
}
@Override
public String toString() {
StringBuilder buf = new StringBuilder();
buf.append(xRange).append(":");
buf.append(yRange).append(":");
buf.append(zRange).append(":");
return buf.toString();
}
/**
* add i to x, y and z and return the resulting class as a new one
*
* @param i
* the summand
* @return the new class
*/
public HarvestRange addXYZ(int i) {
return new HarvestRange(xRange + i, yRange + i, zRange + i);
}
/**
* get range as int array
*
* @return the int array
*/
public int[] getRangeAsArray() {
return new int[] {xRange, yRange, zRange};
}
/**
* @return the xRange
*/
public int getxRange() {
return xRange;
}
/**
* @param xRange
* the xRange to set
*/
public void setxRange(int xRange) {
this.xRange = xRange;
}
/**
* @return the yRange
*/
public int getyRange() {
return yRange;
}
/**
* @param yRange
* the yRange to set
*/
public void setyRange(int yRange) {
this.yRange = yRange;
}
/**
* @return the zRange
*/
public int getzRange() {
return zRange;
}
/**
* @param zRange
* the zRange to set
*/
public void setzRange(int zRange) {
this.zRange = zRange;
}
}

View File

@@ -0,0 +1,45 @@
package de.jottyfan.quickiemod.item;
import de.jottyfan.quickiemod.Quickiemod;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.item.ItemUsageContext;
import net.minecraft.registry.Registries;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
/**
*
* @author jotty
*
*/
public class ItemSeed extends Item64Stack {
private Identifier plant;
public ItemSeed(Identifier identifier, Identifier plant) {
super(identifier);
this.plant = plant;
}
@Override
public ActionResult useOnBlock(ItemUsageContext context) {
BlockPos pos = context.getBlockPos();
World world = context.getWorld();
if (this.asItem().equals(context.getStack().getItem())) {
BlockState state = world.getBlockState(pos);
if (Registries.BLOCK.containsId(plant)) {
if (Blocks.FARMLAND.equals(state.getBlock()) && world.getBlockState(pos.up()).isAir()) {
world.setBlockState(pos.up(), Registries.BLOCK.get(plant).getDefaultState());
context.getStack().decrement(1);
} else {
Quickiemod.LOGGER.error("could not find block {} in Registries...", plant.toShortTranslationKey());
}
}
}
return super.useOnBlock(context);
}
}

View File

@@ -16,9 +16,65 @@ import net.minecraft.util.Identifier;
*
*/
public class ModItems {
public static final Item ITEM_STUB = registerItem(ModIdentifiers.ITEM_STUB, new Item64Stack(ModIdentifiers.ITEM_STUB));
public static final Item ITEM_SPEEDPOWDER = registerItem(ModIdentifiers.ITEM_SPEEDPOWDER, new Item64Stack(ModIdentifiers.ITEM_SPEEDPOWDER));
public static final Item ITEM_QUICKIEPOWDER = registerItem(ModIdentifiers.ITEM_QUICKIEPOWDER, new Item64Stack(ModIdentifiers.ITEM_QUICKIEPOWDER));
public static final Item ITEM_STUB = registerItem(ModIdentifiers.ITEM_STUB,
new Item64Stack(ModIdentifiers.ITEM_STUB));
public static final Item ITEM_SPEEDPOWDER = registerItem(ModIdentifiers.ITEM_SPEEDPOWDER,
new Item64Stack(ModIdentifiers.ITEM_SPEEDPOWDER));
public static final Item ITEM_QUICKIEPOWDER = registerItem(ModIdentifiers.ITEM_QUICKIEPOWDER,
new Item64Stack(ModIdentifiers.ITEM_QUICKIEPOWDER));
public static final Item ITEM_SALPETER = registerItem(ModIdentifiers.ITEM_SALPETER,
new Item64Stack(ModIdentifiers.ITEM_SALPETER));
public static final Item ITEM_SULFOR = registerItem(ModIdentifiers.ITEM_SULFOR,
new Item64Stack(ModIdentifiers.ITEM_SULFOR));
public static final Item ITEM_OXIDIZEDCOPPERPOWDER = registerItem(ModIdentifiers.ITEM_OXIDIZEDCOPPERPOWDER,
new Item64Stack(ModIdentifiers.ITEM_OXIDIZEDCOPPERPOWDER));
public static final Item ITEM_SPEEDINGOT = registerItem(ModIdentifiers.ITEM_SPEEDINGOT,
new Item64Stack(ModIdentifiers.ITEM_SPEEDINGOT));
public static final Item ITEM_QUICKIEINGOT = registerItem(ModIdentifiers.ITEM_QUICKIEINGOT,
new Item64Stack(ModIdentifiers.ITEM_QUICKIEINGOT));
public static final Item ITEM_CARROTSTACK = registerItem(ModIdentifiers.ITEM_CARROTSTACK,
new Item64Stack(ModIdentifiers.ITEM_CARROTSTACK));
public static final Item ITEM_ROTTENFLESHSTRIPES = registerItem(ModIdentifiers.ITEM_ROTTENFLESHSTRIPES,
new Item64Stack(ModIdentifiers.ITEM_ROTTENFLESHSTRIPES));
public static final Item ITEM_COTTON = registerItem(ModIdentifiers.ITEM_COTTON,
new Item64Stack(ModIdentifiers.ITEM_COTTON));
public static final Item ITEM_COTTONPLANT = registerItem(ModIdentifiers.ITEM_COTTONPLANT,
new Item64Stack(ModIdentifiers.BLOCK_COTTONPLANT));
public static final Item ITEM_COTTONSEED = registerItem(ModIdentifiers.ITEM_COTTONSEED,
new ItemSeed(ModIdentifiers.ITEM_COTTONSEED, ModIdentifiers.BLOCK_COTTONPLANT));
public static final Item ITEM_CANOLA = registerItem(ModIdentifiers.ITEM_CANOLA,
new Item64Stack(ModIdentifiers.ITEM_CANOLA));
public static final Item ITEM_CANOLAPLANT = registerItem(ModIdentifiers.ITEM_CANOLAPLANT,
new Item64Stack(ModIdentifiers.BLOCK_CANOLAPLANT));
public static final Item ITEM_CANOLASEED = registerItem(ModIdentifiers.ITEM_CANOLASEED,
new ItemSeed(ModIdentifiers.ITEM_CANOLASEED, ModIdentifiers.BLOCK_CANOLAPLANT));
public static final Item ITEM_CANOLABOTTLE = registerItem(ModIdentifiers.ITEM_CANOLABOTTLE,
new Item64Stack(ModIdentifiers.ITEM_CANOLABOTTLE));
public static final Item ITEM_CANOLABOTTLESTACK = registerItem(ModIdentifiers.ITEM_CANOLABOTTLESTACK,
new Item64Stack(ModIdentifiers.ITEM_CANOLABOTTLESTACK));
public static final Item TOOL_SPEEDPOWDERAXE = registerItem(ModIdentifiers.TOOL_SPEEDPOWDERAXE,
new ToolSpeedpowderAxe(ModIdentifiers.TOOL_SPEEDPOWDERAXE));
public static final Item TOOL_SPEEDPOWDERHOE = registerItem(ModIdentifiers.TOOL_SPEEDPOWDERHOE,
new ToolSpeedpowderHoe(ModIdentifiers.TOOL_SPEEDPOWDERHOE));
public static final Item TOOL_SPEEDPOWDERPICKAXE = registerItem(ModIdentifiers.TOOL_SPEEDPOWDERPICKAXE,
new ToolSpeedpowderPickaxe(ModIdentifiers.TOOL_SPEEDPOWDERPICKAXE));
public static final Item TOOL_SPEEDPOWDERSHEARS = registerItem(ModIdentifiers.TOOL_SPEEDPOWDERSHEARS,
new ToolSpeedpowderShears(ModIdentifiers.TOOL_SPEEDPOWDERSHEARS));
public static final Item TOOL_SPEEDPOWDERSHOVEL = registerItem(ModIdentifiers.TOOL_SPEEDPOWDERSHOVEL,
new ToolSpeedpowderShovel(ModIdentifiers.TOOL_SPEEDPOWDERSHOVEL));
public static final Item TOOL_SPEEDPOWDERWATERHOE = registerItem(ModIdentifiers.TOOL_SPEEDPOWDERWATERHOE,
new ToolSpeedpowderWaterHoe(ModIdentifiers.TOOL_SPEEDPOWDERWATERHOE));
public static final Item TOOL_QUICKIEPOWDERAXE = registerItem(ModIdentifiers.TOOL_QUICKIEPOWDERAXE,
new ToolQuickiepowderAxe(ModIdentifiers.TOOL_QUICKIEPOWDERAXE));
public static final Item TOOL_QUICKIEPOWDERHOE = registerItem(ModIdentifiers.TOOL_QUICKIEPOWDERHOE,
new ToolQuickiepowderHoe(ModIdentifiers.TOOL_QUICKIEPOWDERHOE));
public static final Item TOOL_QUICKIEPOWDERPICKAXE = registerItem(ModIdentifiers.TOOL_QUICKIEPOWDERPICKAXE,
new ToolQuickiepowderPickaxe(ModIdentifiers.TOOL_QUICKIEPOWDERPICKAXE));
public static final Item TOOL_QUICKIEPOWDERSHOVEL = registerItem(ModIdentifiers.TOOL_QUICKIEPOWDERSHOVEL,
new ToolQuickiepowderShovel(ModIdentifiers.TOOL_QUICKIEPOWDERSHOVEL));
public static final Item TOOL_QUICKIEPOWDERWATERHOE = registerItem(ModIdentifiers.TOOL_QUICKIEPOWDERWATERHOE,
new ToolQuickiepowderWaterHoe(ModIdentifiers.TOOL_QUICKIEPOWDERWATERHOE));
private static final Item registerItem(Identifier identifier, Item item) {
return Registry.register(Registries.ITEM, identifier, item);
@@ -31,6 +87,31 @@ public class ModItems {
items.add(ITEM_STUB);
items.add(ITEM_SPEEDPOWDER);
items.add(ITEM_QUICKIEPOWDER);
items.add(ITEM_SALPETER);
items.add(ITEM_SULFOR);
items.add(ITEM_OXIDIZEDCOPPERPOWDER);
items.add(ITEM_SPEEDINGOT);
items.add(ITEM_QUICKIEINGOT);
items.add(ITEM_CARROTSTACK);
items.add(ITEM_ROTTENFLESHSTRIPES);
items.add(ITEM_COTTON);
items.add(ITEM_COTTONSEED);
items.add(ITEM_CANOLA);
items.add(ITEM_CANOLASEED);
items.add(ITEM_CANOLABOTTLE);
items.add(ITEM_CANOLABOTTLESTACK);
items.add(TOOL_SPEEDPOWDERPICKAXE);
items.add(TOOL_SPEEDPOWDERAXE);
items.add(TOOL_SPEEDPOWDERSHOVEL);
items.add(TOOL_SPEEDPOWDERHOE);
items.add(TOOL_SPEEDPOWDERWATERHOE);
items.add(TOOL_SPEEDPOWDERSHEARS);
items.add(TOOL_QUICKIEPOWDERPICKAXE);
items.add(TOOL_QUICKIEPOWDERAXE);
items.add(TOOL_QUICKIEPOWDERSHOVEL);
items.add(TOOL_QUICKIEPOWDERHOE);
items.add(TOOL_QUICKIEPOWDERWATERHOE);
return items;
}
}

View File

@@ -0,0 +1,30 @@
package de.jottyfan.quickiemod.item;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ToolMaterial;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.tag.BlockTags;
import net.minecraft.registry.tag.ItemTags;
import net.minecraft.util.Identifier;
/**
*
* @author jotty
*
*/
public class ToolQuickiepowderAxe extends ToolRangeableAxe {
private final static ToolMaterial MATERIAL = new ToolMaterial(BlockTags.INCORRECT_FOR_DIAMOND_TOOL, 2400, 7f, 1f, 15, ItemTags.DIAMOND_TOOL_MATERIALS);
public ToolQuickiepowderAxe(Identifier identifier) {
super(MATERIAL, 7F, -3.1F, new Item.Settings().useItemPrefixedTranslationKey().registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier)));
}
@Override
public HarvestRange getRange(ItemStack stack) {
// TODO: get the range from the stack
return new HarvestRange(64, 128, 64); // trees bigger than that are too heavy for one small axe...
}
}

View File

@@ -0,0 +1,24 @@
package de.jottyfan.quickiemod.item;
import net.minecraft.item.Item;
import net.minecraft.item.ToolMaterial;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.tag.BlockTags;
import net.minecraft.registry.tag.ItemTags;
import net.minecraft.util.Identifier;
/**
*
* @author jotty
*
*/
public class ToolQuickiepowderHoe extends ToolRangeableHoe {
public static final Integer DEFAULT_PLOW_RANGE = 4;
private final static ToolMaterial MATERIAL = new ToolMaterial(BlockTags.INCORRECT_FOR_DIAMOND_TOOL, 2400, 7f, 1f, 15, ItemTags.DIAMOND_TOOL_MATERIALS);
public ToolQuickiepowderHoe(Identifier identifier) {
super(MATERIAL, 7F, -3.1f, new Item.Settings().useItemPrefixedTranslationKey().registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier)), new HarvestRange(DEFAULT_PLOW_RANGE));
}
}

View File

@@ -0,0 +1,64 @@
package de.jottyfan.quickiemod.item;
import java.util.List;
import com.google.common.collect.Lists;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.PickaxeItem;
import net.minecraft.item.ToolMaterial;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.tag.BlockTags;
import net.minecraft.registry.tag.ItemTags;
import net.minecraft.util.Identifier;
/**
*
* @author jotty
*
*/
public class ToolQuickiepowderPickaxe extends PickaxeItem implements ToolRangeable {
public static final int[] DEFAULT_HARVEST_RANGE = new int[] { 6, 6, 6 };
private final static ToolMaterial MATERIAL = new ToolMaterial(BlockTags.INCORRECT_FOR_DIAMOND_TOOL, 2400, 7f, 1f, 15, ItemTags.DIAMOND_TOOL_MATERIALS);
public ToolQuickiepowderPickaxe(Identifier identifier) {
super(MATERIAL, 7F, -3.1F, new Item.Settings().useItemPrefixedTranslationKey().registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier)));
}
@Override
public boolean isCorrectForDrops(ItemStack stack, BlockState state) {
return super.isCorrectForDrops(stack, state);
}
@Override
public HarvestRange getRange(ItemStack stack) {
return new HarvestRange(DEFAULT_HARVEST_RANGE);
}
@Override
public boolean canBreakNeighbors(BlockState blockIn) {
return new ItemStack(this).isSuitableFor(blockIn);
}
@Override
public List<Block> getBlockList(Block block) {
return Lists.newArrayList(block);
}
// @Override
// public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) {
// CommonToolCode.onItemRightClick(worldIn, playerIn, handIn);
// return super.onItemRightClick(worldIn, playerIn, handIn);
// }
//
// @Override
// public void addInformation(ItemStack stack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
// CommonToolCode.addInformation(stack, worldIn, tooltip, flagIn);
// super.addInformation(stack, worldIn, tooltip, flagIn);
// }
}

View File

@@ -0,0 +1,102 @@
package de.jottyfan.quickiemod.item;
import java.util.List;
import com.google.common.collect.Lists;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUsageContext;
import net.minecraft.item.ShovelItem;
import net.minecraft.item.ToolMaterial;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.tag.BlockTags;
import net.minecraft.registry.tag.ItemTags;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
/**
*
* @author jotty
*
*/
public class ToolQuickiepowderShovel extends ShovelItem implements ToolRangeable {
public static final Integer DEFAULT_HARVEST_RANGE = 6;
private final static ToolMaterial MATERIAL = new ToolMaterial(BlockTags.INCORRECT_FOR_DIAMOND_TOOL, 2400, 7f, 1f, 15, ItemTags.DIAMOND_TOOL_MATERIALS);
public HarvestRange range;
public ToolQuickiepowderShovel(Identifier identifier) {
super(MATERIAL, 7F, -3.1F, new Item.Settings().useItemPrefixedTranslationKey().registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier)));
this.range = new HarvestRange(DEFAULT_HARVEST_RANGE);
}
private void createPathOnGrass(World world, BlockPos pos, Direction side) {
BlockState blockState = world.getBlockState(pos);
if (blockState.isAir()) {
// try to find one underneath
pos = pos.down();
blockState = world.getBlockState(pos);
} else if (!world.getBlockState(pos.up()).isAir()) {
pos = pos.up();
blockState = world.getBlockState(pos);
}
if (side != Direction.DOWN) {
BlockState blockState2 = (BlockState) PATH_STATES.get(blockState.getBlock());
if (blockState2 != null && world.getBlockState(pos.up()).isAir()) {
if (!world.isClient) {
world.setBlockState(pos, blockState2, 11);
}
}
}
}
@Override
public ActionResult useOnBlock(ItemUsageContext context) {
World world = context.getWorld();
BlockPos pos = context.getBlockPos();
BlockPos[] positions = new BlockPos[] { pos.north().north().west().west(), pos.north().north().west(),
pos.north().north(), pos.north().north().east(), pos.north().north().east().east(), pos.north().west().west(),
pos.north().west(), pos.north(), pos.north().east(), pos.north().east().east(), pos.west().west(), pos.west(),
pos, pos.east(), pos.east().east(), pos.south().west().west(), pos.south().west(), pos.south(),
pos.south().east(), pos.south().east().east(), pos.south().south().west().west(), pos.south().south().west(),
pos.south().south(), pos.south().south().east(), pos.south().south().east().east() };
for (BlockPos p : positions) {
createPathOnGrass(world, p, context.getSide());
}
return super.useOnBlock(context);
}
@Override
public HarvestRange getRange(ItemStack stack) {
// TODO: get range from stack
return range;
}
@Override
public boolean canBreakNeighbors(BlockState blockState) {
return new ItemStack(this).isSuitableFor(blockState);
}
@Override
public List<Block> getBlockList(Block block) {
return Lists.newArrayList(block);
}
// @Override
// public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) {
// CommonToolCode.onItemRightClick(worldIn, playerIn, handIn);
// return super.onItemRightClick(worldIn, playerIn, handIn);
// }
//
// @Override
// public void addInformation(ItemStack stack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
// CommonToolCode.addInformation(stack, worldIn, tooltip, flagIn);
// super.addInformation(stack, worldIn, tooltip, flagIn);
// }
}

View File

@@ -0,0 +1,43 @@
package de.jottyfan.quickiemod.item;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUsageContext;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
/**
*
* @author jotty
*
*/
public class ToolQuickiepowderWaterHoe extends ToolQuickiepowderHoe {
public ToolQuickiepowderWaterHoe(Identifier identifier) {
super(identifier);
}
@Override
public ActionResult useOnBlock(ItemUsageContext context) {
ActionResult res = super.useOnBlock(context);
if (!ActionResult.PASS.equals(res)) {
BlockPos pos = context.getBlockPos();
World world = context.getWorld();
BlockState oldBlockState = world.getBlockState(pos);
world.setBlockState(pos, Blocks.WATER.getDefaultState());
Hand hand = context.getHand();
PlayerEntity player = context.getPlayer();
ItemStack oldTool = player.getStackInHand(hand);
ItemStack newTool = new ItemStack(ModItems.TOOL_QUICKIEPOWDERHOE);
newTool.setDamage(oldTool.getDamage());
world.spawnEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(oldBlockState.getBlock())));
player.setStackInHand(hand, newTool);
}
return res;
}
}

View File

@@ -0,0 +1,46 @@
package de.jottyfan.quickiemod.item;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.text.Text;
/**
*
* @author jotty
*
*/
public interface ToolRangeable {
/**
* dummy to have a getName method that comes with the item
*
* @return the name
*/
public Text getName();
/**
* @param stack the item stack that keeps the range
* @return range of blocks to be harvested
*/
public HarvestRange getRange(ItemStack stack);
/**
* check if this block state is one that affects the neighbor blocks to break
* also if they are from the same type
*
* @param blockState the block state of the current block
* @return true or false
*/
public boolean canBreakNeighbors(BlockState blockState);
/**
* get list of blocks that belong together (could be useful for stripped logs)
*
* @param block of the set
* @return the list of blocks or null if not found
*/
public List<Block> getBlockList(Block block);
}

View File

@@ -0,0 +1,63 @@
package de.jottyfan.quickiemod.item;
import java.util.List;
import com.google.common.collect.Lists;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.LeavesBlock;
import net.minecraft.item.AxeItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ToolMaterial;
import net.minecraft.registry.tag.BlockTags;
/**
*
* @author jotty
*
*/
public abstract class ToolRangeableAxe extends AxeItem implements ToolRangeable {
protected ToolRangeableAxe(ToolMaterial material, float attackDamage, float attackSpeed, Item.Settings settings) {
super(material, attackDamage, attackSpeed, settings);
}
@Override
public HarvestRange getRange(ItemStack stack) {
// TODO: get the range from the stack
return new HarvestRange(16, 32, 16);
}
/**
* check if the block is a leaves block
*
* @param blockIn the block
* @return true or false
*/
private boolean isLeavesBlock(BlockState blockIn) {
boolean vanillaLeaves = blockIn.getBlock() instanceof LeavesBlock;
boolean terrestriaLeaves = false;
try {
Class<?> extendedLeavesBlock = Class.forName("com.terraformersmc.terraform.leaves.block.ExtendedLeavesBlock");
terrestriaLeaves = extendedLeavesBlock.isInstance(blockIn.getBlock());
} catch (ClassNotFoundException e) {
// no terrestria mod available, so ignore this
// using this approach instead of the instanceof functionality, we don't need to refer to terrestria
// and omit a crash on installations that do not have or want terrestria available
}
boolean blockTagLeaves = blockIn.isIn(BlockTags.LEAVES);
return vanillaLeaves || terrestriaLeaves || blockTagLeaves;
}
@Override
public boolean canBreakNeighbors(BlockState blockIn) {
return new ItemStack(this).isSuitableFor(blockIn) || isLeavesBlock(blockIn) || blockIn.isIn(BlockTags.LOGS);
}
@Override
public List<Block> getBlockList(Block block) {
return Lists.newArrayList(block);
}
}

View File

@@ -0,0 +1,97 @@
package de.jottyfan.quickiemod.item;
import java.util.List;
import com.google.common.collect.Lists;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.CropBlock;
import net.minecraft.item.HoeItem;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUsageContext;
import net.minecraft.item.ToolMaterial;
import net.minecraft.util.ActionResult;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3i;
import net.minecraft.world.World;
/**
*
* @author jotty
*
*/
public abstract class ToolRangeableHoe extends HoeItem implements ToolRangeable {
public HarvestRange range;
public ToolRangeableHoe(ToolMaterial material, float attackDamage, float attackSpeed, Settings settings, HarvestRange range) {
super(material, attackDamage, attackSpeed, settings);
this.range = range;
}
@Override
public ActionResult useOnBlock(ItemUsageContext context) {
ActionResult res = super.useOnBlock(context);
boolean isCrop = context.getWorld().getBlockState(context.getBlockPos()).getBlock() instanceof CropBlock;
if (!ActionResult.PASS.equals(res) || isCrop) {
for (int x = -this.range.getxRange(); x <= this.range.getxRange(); x++) {
for (int y = -this.range.getyRange(); y <= this.range.getyRange(); y++) {
for (int z = -this.range.getzRange(); z <= this.range.getzRange(); z++) {
if (!isCrop) {
removePossibleGrass(context.getWorld(), new BlockPos(x, y, z));
BlockHitResult bhr = new BlockHitResult(context.getHitPos(), Direction.UP,
context.getBlockPos().add(new Vec3i(x, y, z)), false);
ItemUsageContext ctx = new ItemUsageContext(context.getPlayer(), context.getHand(), bhr);
super.useOnBlock(ctx);
} else {
harvestIfPossible(context.getBlockPos().add(x, y, z), context.getWorld());
}
}
}
}
}
return res;
}
private void removePossibleGrass(World world, BlockPos pos) {
Block block = world.getBlockState(pos).getBlock();
Boolean grassFound = Blocks.FERN.equals(block) || Blocks.LARGE_FERN.equals(block)
|| Blocks.SHORT_GRASS.equals(block) || Blocks.TALL_GRASS.equals(block);
if (grassFound) {
world.breakBlock(pos, true);
}
}
private void harvestIfPossible(BlockPos pos, World world) {
BlockState blockState = world.getBlockState(pos);
Block block = blockState.getBlock();
if (block instanceof CropBlock) {
CropBlock cBlock = (CropBlock) block;
if (cBlock.isMature(blockState)) {
Block.dropStacks(blockState, world, pos);
world.setBlockState(pos, cBlock.withAge(0));
}
}
}
@Override
public HarvestRange getRange(ItemStack stack) {
// TODO: get range from stack
return range;
}
@Override
public boolean canBreakNeighbors(BlockState blockState) {
return new ItemStack(this).isSuitableFor(blockState) || Blocks.TALL_GRASS.equals(blockState.getBlock())
|| Blocks.FERN.equals(blockState.getBlock()) || Blocks.LARGE_FERN.equals(blockState.getBlock());
}
@Override
public List<Block> getBlockList(Block block) {
return Lists.newArrayList(block);
}
}

View File

@@ -0,0 +1,30 @@
package de.jottyfan.quickiemod.item;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ToolMaterial;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.tag.BlockTags;
import net.minecraft.registry.tag.ItemTags;
import net.minecraft.util.Identifier;
/**
*
* @author jotty
*
*/
public class ToolSpeedpowderAxe extends ToolRangeableAxe {
private final static ToolMaterial MATERIAL = new ToolMaterial(BlockTags.INCORRECT_FOR_DIAMOND_TOOL, 800, 7f, 1f, 15, ItemTags.DIAMOND_TOOL_MATERIALS);
public ToolSpeedpowderAxe(Identifier identifier) {
super(MATERIAL, 7f, -3.1f, new Item.Settings().useItemPrefixedTranslationKey().registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier)));
}
@Override
public HarvestRange getRange(ItemStack stack) {
// TODO: get the range from the stack
return new HarvestRange(32, 64, 32);
}
}

View File

@@ -0,0 +1,24 @@
package de.jottyfan.quickiemod.item;
import net.minecraft.item.Item;
import net.minecraft.item.ToolMaterial;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.tag.BlockTags;
import net.minecraft.registry.tag.ItemTags;
import net.minecraft.util.Identifier;
/**
*
* @author jotty
*
*/
public class ToolSpeedpowderHoe extends ToolRangeableHoe {
public static final Integer DEFAULT_PLOW_RANGE = 2;
private final static ToolMaterial MATERIAL = new ToolMaterial(BlockTags.INCORRECT_FOR_DIAMOND_TOOL, 800, 7f, 1f, 15, ItemTags.DIAMOND_TOOL_MATERIALS);
public ToolSpeedpowderHoe(Identifier identifier) {
super(MATERIAL, 7F, -3.1F, new Item.Settings().useItemPrefixedTranslationKey().registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier)), new HarvestRange(DEFAULT_PLOW_RANGE));
}
}

View File

@@ -0,0 +1,59 @@
package de.jottyfan.quickiemod.item;
import java.util.List;
import com.google.common.collect.Lists;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.PickaxeItem;
import net.minecraft.item.ToolMaterial;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.tag.BlockTags;
import net.minecraft.registry.tag.ItemTags;
import net.minecraft.util.Identifier;
/**
*
* @author jotty
*
*/
public class ToolSpeedpowderPickaxe extends PickaxeItem implements ToolRangeable {
public static final int[] DEFAULT_HARVEST_RANGE = new int[] { 3, 3, 3 };
private final static ToolMaterial MATERIAL = new ToolMaterial(BlockTags.INCORRECT_FOR_DIAMOND_TOOL, 800, 7.0F, 1.0F, 15, ItemTags.DIAMOND_TOOL_MATERIALS);
public ToolSpeedpowderPickaxe(Identifier identifier) {
super(MATERIAL, 7F, -3.1F, new Item.Settings().useItemPrefixedTranslationKey().registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier)));
}
@Override
public HarvestRange getRange(ItemStack stack) {
return new HarvestRange(DEFAULT_HARVEST_RANGE);
}
@Override
public boolean canBreakNeighbors(BlockState blockIn) {
return new ItemStack(this).isSuitableFor(blockIn);
}
@Override
public List<Block> getBlockList(Block block) {
return Lists.newArrayList(block);
}
// @Override
// public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) {
// CommonToolCode.onItemRightClick(worldIn, playerIn, handIn);
// return super.onItemRightClick(worldIn, playerIn, handIn);
// }
//
// @Override
// public void addInformation(ItemStack stack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
// CommonToolCode.addInformation(stack, worldIn, tooltip, flagIn);
// super.addInformation(stack, worldIn, tooltip, flagIn);
// }
}

View File

@@ -0,0 +1,99 @@
package de.jottyfan.quickiemod.item;
import java.util.Random;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.entity.ItemEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.passive.ChickenEntity;
import net.minecraft.entity.passive.CowEntity;
import net.minecraft.entity.passive.HorseEntity;
import net.minecraft.entity.passive.SheepEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.item.ShearsItem;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.ActionResult;
import net.minecraft.util.DyeColor;
import net.minecraft.util.Hand;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.Vec3d;
/**
*
* @author jotty
*
*/
public class ToolSpeedpowderShears extends ShearsItem {
public ToolSpeedpowderShears(Identifier identifier) {
super(new Item.Settings().component(DataComponentTypes.TOOL, ShearsItem.createToolComponent()).useItemPrefixedTranslationKey().registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier)));
}
@Override
public ActionResult useOnEntity(ItemStack stack, PlayerEntity user, LivingEntity entity, Hand hand) {
Vec3d pos = entity.getPos();
Integer amount = 3 + new Random().nextInt(4);
if (entity instanceof SheepEntity) {
SheepEntity sheep = (SheepEntity) entity;
if (sheep.isShearable()) {
sheep.setSheared(true);
sheep.playAmbientSound();
DyeColor color = sheep.getColor();
Item item = Items.WHITE_WOOL;
if (color.equals(DyeColor.BLACK)) {
item = Items.BLACK_WOOL;
} else if (color.equals(DyeColor.GRAY)) {
item = Items.GRAY_WOOL;
} else if (color.equals(DyeColor.LIGHT_GRAY)) {
item = Items.LIGHT_GRAY_WOOL;
} else if (color.equals(DyeColor.BROWN)) {
item = Items.BROWN_WOOL;
} else if (color.equals(DyeColor.BLUE)) {
item = Items.BLUE_WOOL;
} else if (color.equals(DyeColor.LIGHT_BLUE)) {
item = Items.LIGHT_BLUE_WOOL;
} else if (color.equals(DyeColor.GREEN)) {
item = Items.GREEN_WOOL;
} else if (color.equals(DyeColor.LIME)) {
item = Items.LIME_WOOL;
} else if (color.equals(DyeColor.CYAN)) {
item = Items.CYAN_WOOL;
} else if (color.equals(DyeColor.MAGENTA)) {
item = Items.MAGENTA_WOOL;
} else if (color.equals(DyeColor.ORANGE)) {
item = Items.ORANGE_WOOL;
} else if (color.equals(DyeColor.PINK)) {
item = Items.PINK_WOOL;
} else if (color.equals(DyeColor.PURPLE)) {
item = Items.PURPLE_WOOL;
} else if (color.equals(DyeColor.RED)) {
item = Items.RED_WOOL;
} else if (color.equals(DyeColor.YELLOW)) {
item = Items.YELLOW_WOOL;
}
user.getWorld().spawnEntity(new ItemEntity(user.getWorld(), pos.getX(), pos.getY(), pos.getZ(), new ItemStack(item, amount)));
return ActionResult.SUCCESS;
}
} else if (entity instanceof HorseEntity) {
HorseEntity horse = (HorseEntity) entity;
horse.playAmbientSound();
user.getWorld().spawnEntity(new ItemEntity(user.getWorld(), pos.getX(), pos.getY(), pos.getZ(), new ItemStack(Items.LEATHER, amount)));
return ActionResult.SUCCESS;
} else if (entity instanceof CowEntity) {
CowEntity cow = (CowEntity) entity;
cow.playAmbientSound();
user.getWorld().spawnEntity(new ItemEntity(user.getWorld(), pos.getX(), pos.getY(), pos.getZ(), new ItemStack(Items.LEATHER, amount)));
return ActionResult.SUCCESS;
} else if (entity instanceof ChickenEntity) {
ChickenEntity cow = (ChickenEntity) entity;
cow.playAmbientSound();
user.getWorld().spawnEntity(new ItemEntity(user.getWorld(), pos.getX(), pos.getY(), pos.getZ(), new ItemStack(Items.FEATHER, amount)));
return ActionResult.SUCCESS;
}
return ActionResult.PASS;
}
}

View File

@@ -0,0 +1,101 @@
package de.jottyfan.quickiemod.item;
import java.util.List;
import com.google.common.collect.Lists;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUsageContext;
import net.minecraft.item.ShovelItem;
import net.minecraft.item.ToolMaterial;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.tag.BlockTags;
import net.minecraft.registry.tag.ItemTags;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
/**
*
* @author jotty
*
*/
public class ToolSpeedpowderShovel extends ShovelItem implements ToolRangeable {
public static final Integer DEFAULT_HARVEST_RANGE = 3;
private final static ToolMaterial MATERIAL = new ToolMaterial(BlockTags.INCORRECT_FOR_DIAMOND_TOOL, 800, 7f, 1f, 15, ItemTags.DIAMOND_TOOL_MATERIALS);
public HarvestRange range;
public ToolSpeedpowderShovel(Identifier identifier) {
super(MATERIAL, 7F, -3.1F, new Item.Settings().useItemPrefixedTranslationKey().registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier)));
this.range = new HarvestRange(DEFAULT_HARVEST_RANGE);
}
private void createPathOnGrass(World world, BlockPos pos, Direction side) {
BlockState blockState = world.getBlockState(pos);
if (blockState.isAir()) {
// try to find one underneath
pos = pos.down();
blockState = world.getBlockState(pos);
} else if (!world.getBlockState(pos.up()).isAir()) {
pos = pos.up();
blockState = world.getBlockState(pos);
}
if (side != Direction.DOWN) {
BlockState blockState2 = (BlockState) PATH_STATES.get(blockState.getBlock());
if (blockState2 != null && world.getBlockState(pos.up()).isAir()) {
if (!world.isClient) {
world.setBlockState(pos, blockState2, 11);
}
}
}
}
@Override
public ActionResult useOnBlock(ItemUsageContext context) {
World world = context.getWorld();
BlockPos pos = context.getBlockPos();
createPathOnGrass(world, pos.north(), context.getSide());
createPathOnGrass(world, pos.north().east(), context.getSide());
createPathOnGrass(world, pos.north().west(), context.getSide());
createPathOnGrass(world, pos.east(), context.getSide());
createPathOnGrass(world, pos.west(), context.getSide());
createPathOnGrass(world, pos.south(), context.getSide());
createPathOnGrass(world, pos.south().east(), context.getSide());
createPathOnGrass(world, pos.south().west(), context.getSide());
return super.useOnBlock(context);
}
@Override
public HarvestRange getRange(ItemStack stack) {
// TODO: get range from stack
return range;
}
@Override
public boolean canBreakNeighbors(BlockState blockState) {
return new ItemStack(this).isSuitableFor(blockState);
}
@Override
public List<Block> getBlockList(Block block) {
return Lists.newArrayList(block);
}
// @Override
// public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) {
// CommonToolCode.onItemRightClick(worldIn, playerIn, handIn);
// return super.onItemRightClick(worldIn, playerIn, handIn);
// }
//
// @Override
// public void addInformation(ItemStack stack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
// CommonToolCode.addInformation(stack, worldIn, tooltip, flagIn);
// super.addInformation(stack, worldIn, tooltip, flagIn);
// }
}

View File

@@ -0,0 +1,43 @@
package de.jottyfan.quickiemod.item;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUsageContext;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
/**
*
* @author jotty
*
*/
public class ToolSpeedpowderWaterHoe extends ToolSpeedpowderHoe {
public ToolSpeedpowderWaterHoe(Identifier identifier) {
super(identifier);
}
@Override
public ActionResult useOnBlock(ItemUsageContext context) {
ActionResult res = super.useOnBlock(context);
if (!ActionResult.PASS.equals(res)) {
BlockPos pos = context.getBlockPos();
World world = context.getWorld();
BlockState oldBlockState = world.getBlockState(pos);
world.setBlockState(pos, Blocks.WATER.getDefaultState());
Hand hand = context.getHand();
PlayerEntity player = context.getPlayer();
ItemStack oldTool = player.getStackInHand(hand);
ItemStack newTool = new ItemStack(ModItems.TOOL_SPEEDPOWDERHOE);
newTool.setDamage(oldTool.getDamage());
world.spawnEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(oldBlockState.getBlock())));
player.setStackInHand(hand, newTool);
}
return res;
}
}

View File

@@ -1,4 +1,4 @@
package de.jottyfan.quickiemod.tab;
package de.jottyfan.quickiemod.itemgroup;
import java.util.List;
@@ -20,9 +20,9 @@ import net.minecraft.util.Identifier;
* @author jotty
*
*/
public class ModTabs {
public class ModItemGroup {
public static final void registerTab(List<Item> items, List<Block> blocks) {
public static final void registerItemGroup(List<Item> items, List<Block> blocks) {
Registry.register(Registries.ITEM_GROUP,
RegistryKey.of(RegistryKeys.ITEM_GROUP, Identifier.of(Quickiemod.MOD_ID, "itemgroup")),
FabricItemGroup.builder().icon(() -> new ItemStack(ModItems.ITEM_SPEEDPOWDER))

View File

@@ -1,15 +0,0 @@
package de.jottyfan.quickiemod.mixin;
import net.minecraft.server.MinecraftServer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(MinecraftServer.class)
public class ExampleMixin {
@Inject(at = @At("HEAD"), method = "loadWorld")
private void init(CallbackInfo info) {
// This code is injected into the start of MinecraftServer.loadWorld()V
}
}

View File

@@ -0,0 +1,28 @@
package de.jottyfan.quickiemod.util;
import de.jottyfan.quickiemod.Quickiemod;
import net.minecraft.block.Block;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.util.Identifier;
/**
*
* @author jotty
*
*/
public class ModTags {
public static final class Blocks {
public static final TagKey<Block> SPEEDPOWDER_TOOL = createTag("speedpowder_tool");
public static final TagKey<Block> QUICKIEPOWDER_TOOL = createTag("quickiepowder_tool");
private static final TagKey<Block> createTag(String name) {
return TagKey.of(RegistryKeys.BLOCK, Identifier.of(Quickiemod.MOD_ID, name));
}
}
public static final class Items {
}
}

View File

@@ -0,0 +1,12 @@
{
"variants": {
"age=0": { "model": "quickiemod:block/canolaplant0" },
"age=1": { "model": "quickiemod:block/canolaplant1" },
"age=2": { "model": "quickiemod:block/canolaplant2" },
"age=3": { "model": "quickiemod:block/canolaplant3" },
"age=4": { "model": "quickiemod:block/canolaplant4" },
"age=5": { "model": "quickiemod:block/canolaplant5" },
"age=6": { "model": "quickiemod:block/canolaplant6" },
"age=7": { "model": "quickiemod:block/canolaplant7" }
}
}

View File

@@ -0,0 +1,12 @@
{
"variants": {
"age=0": { "model": "quickiemod:block/cottonplant0" },
"age=1": { "model": "quickiemod:block/cottonplant1" },
"age=2": { "model": "quickiemod:block/cottonplant2" },
"age=3": { "model": "quickiemod:block/cottonplant3" },
"age=4": { "model": "quickiemod:block/cottonplant4" },
"age=5": { "model": "quickiemod:block/cottonplant5" },
"age=6": { "model": "quickiemod:block/cottonplant6" },
"age=7": { "model": "quickiemod:block/cottonplant7" }
}
}

View File

@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "quickiemod:block/blocksalpeter"
}
}
}

View File

@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "quickiemod:block/blocksulphor"
}
}
}

View File

@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "quickiemod:block/dirtsalpeter"
}
}
}

View File

@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "quickiemod:block/emptylavahoarder"
}
}
}

View File

@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "quickiemod:block/itemhoarder"
}
}
}

View File

@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "quickiemod:block/kelpstack"
}
}
}

View File

@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "quickiemod:block/lavahoarder"
}
}
}

View File

@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "quickiemod:block/monsterhoarder"
}
}
}

View File

@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "quickiemod:block/oredeepslatesulphor"
}
}
}

View File

@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "quickiemod:block/orenethersulphor"
}
}
}

View File

@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "quickiemod:block/oresalpeter"
}
}
}

View File

@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "quickiemod:block/oresandsalpeter"
}
}
}

View File

@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "quickiemod:block/oresulphor"
}
}
}

View File

@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "quickiemod:block/sandsalpeter"
}
}
}

View File

@@ -69,8 +69,8 @@
"block.quickiemod.itemhoarder": "Itemsauger",
"block.quickiemod.monsterhoarder": "Monstersauger",
"block.quickiemod.kelpstack": "Seegrassbündel",
"block.quickiemod.cottonplant": "Baumwollpflanze",
"block.quickiemod.canolaplant": "Canolapflanze",
"block.quickiemod.blockcottonplant": "Baumwollpflanze",
"block.quickiemod.blockcanolaplant": "Canolapflanze",
"block.quickiemod.blocksulphor": "Schwefelblock",
"block.quickiemod.blocksalpeter": "Salpeterblock",
"block.quickiemod.blockspeedpowder": "Fluchtpulverblock",
@@ -103,6 +103,7 @@
"msg.buildingplan.failonblock": "Der Bau wurde abgelehnt, es ist im Weg: %s",
"msg.buildingplan.failonplayer": "Der Bau wurde abgelehnt, um Spieler %s nicht zu gefährden.",
"msg.itemhoarder.summary": "Der Itemsauger enthält: %s",
"msg.monsterhoarder.size": "Der Radius für diesen Monstersauger beträgt jetzt %d.",
"msg.notyetimplemented": "leider noch nicht verfügbar",
"msg.backpack.transfer.filled": "Der Rucksack wurde befüllt.",
"msg.backpack.transfer.cleared": "Der Rucksackinhalt wurde soweit möglich geleert.",

View File

@@ -69,8 +69,8 @@
"block.quickiemod.itemhoarder": "item hoarder",
"block.quickiemod.monsterhoarder": "monster hoarder",
"block.quickiemod.kelpstack": "kelp bundle",
"block.quickiemod.cottonplant": "cotton plant",
"block.quickiemod.canolaplant": "canola plant",
"block.quickiemod.blockcottonplant": "cotton plant",
"block.quickiemod.blockcanolaplant": "canola plant",
"block.quickiemod.blocksulphor": "block of sulfur",
"block.quickiemod.blocksalpeter": "block of salpeter",
"block.quickiemod.blockspeedpowder": "block of speedpowder",
@@ -103,6 +103,7 @@
"msg.buildingplan.failonblock": "The building execution was rejected because of %s",
"msg.buildingplan.failonplayer": "The building execution was rejected because of %s who could be injured.",
"msg.itemhoarder.summary": "The item hoarder contains: %s",
"msg.monsterhoarder.size": "The radius for this monster hoarder is %d from now on.",
"msg.notyetimplemented": "not yet implemented",
"msg.backpack.transfer.filled": "Filled the backpack.",
"msg.backpack.transfer.cleared": "Cleared the backpack as much as possible.",

View File

@@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "quickiemod:block/blocksalpeter"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "quickiemod:block/blocksulphor"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent":"block/cross",
"textures":{
"cross":"quickiemod:block/canolaplant0"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent":"block/cross",
"textures":{
"cross":"quickiemod:block/canolaplant1"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent":"block/cross",
"textures":{
"cross":"quickiemod:block/canolaplant2"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent":"block/cross",
"textures":{
"cross":"quickiemod:block/canolaplant3"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent":"block/cross",
"textures":{
"cross":"quickiemod:block/canolaplant4"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent":"block/cross",
"textures":{
"cross":"quickiemod:block/canolaplant5"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent":"block/cross",
"textures":{
"cross":"quickiemod:block/canolaplant6"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent":"block/cross",
"textures":{
"cross":"quickiemod:block/canolaplant7"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent":"block/cross",
"textures":{
"cross":"quickiemod:block/cottonplant0"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent":"block/cross",
"textures":{
"cross":"quickiemod:block/cottonplant1"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent":"block/cross",
"textures":{
"cross":"quickiemod:block/cottonplant2"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent":"block/cross",
"textures":{
"cross":"quickiemod:block/cottonplant3"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent":"block/cross",
"textures":{
"cross":"quickiemod:block/cottonplant4"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent":"block/cross",
"textures":{
"cross":"quickiemod:block/cottonplant5"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent":"block/cross",
"textures":{
"cross":"quickiemod:block/cottonplant6"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent":"block/cross",
"textures":{
"cross":"quickiemod:block/cottonplant7"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "quickiemod:block/dirtsalpeter"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "quickiemod:block/emptylavahoarder"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "quickiemod:block/itemhoarder"
}
}

View File

@@ -0,0 +1,25 @@
{
"parent": "block/block",
"textures": {
"particle": "quickiemod:block/kelpstack_side",
"down": "quickiemod:block/kelpstack_bottom",
"up": "quickiemod:block/kelpstack_top",
"north": "quickiemod:block/kelpstack_side",
"east": "quickiemod:block/kelpstack_side",
"south": "quickiemod:block/kelpstack_side",
"west": "quickiemod:block/kelpstack_side"
},
"elements": [
{ "from": [ 0, 0, 0 ],
"to": [ 16, 16, 16 ],
"faces": {
"down": { "texture": "#down", "cullface": "down" },
"up": { "texture": "#up", "cullface": "up" },
"north": { "texture": "#north", "cullface": "north" },
"south": { "uv": [16, 0, 0, 16], "texture": "#south", "cullface": "south" },
"west": { "texture": "#west", "cullface": "west" },
"east": { "uv": [16, 0, 0, 16], "texture": "#east", "cullface": "east" }
}
}
]
}

View File

@@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "quickiemod:block/lavahoarder"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "quickiemod:block/monsterhoarder"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "quickiemod:block/oredeepslatesulphor"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "quickiemod:block/orenethersulphor"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "quickiemod:block/oresalpeter"
}
}

View File

@@ -0,0 +1,7 @@
{
"parent": "block/cube_column",
"textures": {
"end" : "minecraft:block/sandstone_top",
"side": "quickiemod:block/oresandsalpeter"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "quickiemod:block/oresulphor"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "quickiemod:block/sandsalpeter"
}
}

View File

@@ -0,0 +1,10 @@
{
"parent": "quickiemod:block/blocksalpeter",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View File

@@ -0,0 +1,10 @@
{
"parent": "quickiemod:block/blocksulphor",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "quickiemod:item/canola"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "quickiemod:item/canolabottle"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "quickiemod:item/canolabottlestack"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "quickiemod:item/canolaseed"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "quickiemod:item/canolaseed"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "quickiemod:item/carrotstack"
}
}

Some files were not shown because too many files have changed in this diff Show More