Skip to content

Commit

Permalink
Infinite Fuel & Steak and #18
Browse files Browse the repository at this point in the history
  • Loading branch information
DonovanDMC committed Apr 1, 2022
1 parent e5c6588 commit 955c1fa
Show file tree
Hide file tree
Showing 39 changed files with 805 additions and 166 deletions.
1 change: 0 additions & 1 deletion scripts/other-notes

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "projectexpansion:block/transmutation_interface"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "projectexpansion:block/transmutation_interface"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"0": "projectexpansion:block/arcane_table/top",
"1": "projectexpansion:block/arcane_table/bottom",
"2": "projectexpansion:block/arcane_table/side",
"particle": "projectexpansion:block/arcane/top"
"particle": "projectexpansion:block/arcane_table/top"
},
"elements": [
{
Expand Down
6 changes: 6 additions & 0 deletions src/main/generation/generators/item/single/infinite_fuel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/handheld",
"textures": {
"layer0": "projectexpansion:item/infinite_fuel"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/handheld",
"textures": {
"layer0": "projectexpansion:item/infinite_steak"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "projectexpansion:block/transmutation_interface"
}
4 changes: 3 additions & 1 deletion src/main/generation/generators/lang/en_US/block/misc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
"block.projectexpansion.emc_export.not_owner": "You are not the owner of this, %s is.",
"block.projectexpansion.emc_import": "EMC Import",
"block.projectexpansion.emc_import.tooltip": "Import items directly into your emc.",
"block.projectexpansion.emc_import.not_owner": "You are not the owner of this, %s is."
"block.projectexpansion.emc_import.not_owner": "You are not the owner of this, %s is.",
"block.projectexpansion.transmutation_interface": "Transmutation Interface",
"block.projectexpansion.transmutation_interface.tooltip": "This can be used with compatible mods like Refined Storage to access your transmutation inventory."
}
14 changes: 10 additions & 4 deletions src/main/generation/generators/lang/en_US/item/misc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"item.projectexpansion.arcane_tablet": "Arcane Tablet",
"item.projectexpansion.final_star_shard": "Final Star Shard",
"item.projectexpansion.final_star": "Final Star",
"item.projectexpansion.final_star.tooltip": "This does nothing, it exists to show off."
"item.projectexpansion.arcane_tablet": "Arcane Tablet",
"item.projectexpansion.final_star_shard": "Final Star Shard",
"item.projectexpansion.final_star": "Final Star",
"item.projectexpansion.final_star.tooltip": "This does nothing, it exists to show off.",
"item.projectexpansion.infinite_fuel": "Infinite Fuel",
"item.projectexpansion.infinite_fuel.tooltip": "This item will not be consumed, fuel will be provided via your emc.",
"item.projectexpansion.infinite_fuel.not_enough_emc": "You do not have enough emc to use this, you need %s.",
"item.projectexpansion.infinite_steak": "Infinite Steak",
"item.projectexpansion.infinite_steak.tooltip": "Infinite food via your emc.",
"item.projectexpansion.infinite_steak.not_enough_emc": "You do not have enough emc to use this, you need %s."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "projectexpansion:transmutation_interface"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}
19 changes: 19 additions & 0 deletions src/main/generation/generators/recipes/single/infinite_fuel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"CCC",
"CTC",
"CCC"
],
"key": {
"C": {
"item": "minecraft:coal"
},
"T": {
"item": "projecte:transmutation_tablet"
}
},
"result": {
"item": "projectexpansion:infinite_fuel"
}
}
19 changes: 19 additions & 0 deletions src/main/generation/generators/recipes/single/infinite_steak.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"SSS",
"STS",
"SSS"
],
"key": {
"S": {
"item": "minecraft:cooked_beef"
},
"T": {
"item": "projecte:transmutation_tablet"
}
},
"result": {
"item": "projectexpansion:infinite_steak"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"EIE",
"ILI",
"EIE"
],
"key": {
"L": {
"item": "projectexpansion:emc_link"
},
"I": {
"item": "projectexpansion:emc_import"
},
"E": {
"item": "projectexpansion:emc_export"
}
},
"result": {
"item": "projectexpansion:transmutation_interface"
}
}
16 changes: 16 additions & 0 deletions src/main/java/cool/furry/mc/forge/projectexpansion/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,19 @@
import cool.furry.mc.forge.projectexpansion.util.Fuel;
import cool.furry.mc.forge.projectexpansion.util.Matter;
import cool.furry.mc.forge.projectexpansion.util.Star;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.config.ModConfig;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fml.server.ServerLifecycleHooks;
import org.apache.logging.log4j.LogManager;

import javax.annotation.Nonnull;
Expand All @@ -43,11 +47,23 @@ public ItemStack createIcon() {
Items.Registry.register(bus);
TileEntityTypes.Registry.register(bus);
ContainerTypes.Registry.register(bus);
MinecraftForge.EVENT_BUS.addListener(this::serverTick);

ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, Config.Spec, "project-expansion.toml");

Fuel.registerAll();
Matter.registerAll();
Star.registerAll();
}

private void serverTick(TickEvent.ServerTickEvent event) {
if (event.phase != TickEvent.Phase.END) return;
for (ServerPlayerEntity player : ServerLifecycleHooks.getCurrentServer().getPlayerList().getPlayers()) {
for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
ItemStack stack = player.inventory.getStackInSlot(i);
if (stack.getItem().equals(Items.INFINITE_FUEL.get()))
stack.getOrCreateTag().putUniqueId("Owner", player.getUniqueID());
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package cool.furry.mc.forge.projectexpansion.block;

import cool.furry.mc.forge.projectexpansion.tile.TileTransmutationInterface;
import cool.furry.mc.forge.projectexpansion.util.ColorStyle;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.material.Material;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

import javax.annotation.Nullable;
import java.util.List;

public class BlockTransmutationInterface extends Block {
public BlockTransmutationInterface() {
super(Block.Properties.create(Material.ROCK).hardnessAndResistance(5F));
}

@Override
public boolean hasTileEntity(BlockState state) {
return true;
}

@Nullable
@Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return new TileTransmutationInterface();
}

@OnlyIn(Dist.CLIENT)
@Override
public void addInformation(ItemStack stack, @Nullable IBlockReader level, List<ITextComponent> list, ITooltipFlag flag) {
super.addInformation(stack, level, list, flag);
list.add(new TranslationTextComponent("block.projectexpansion.transmutation_interface.tooltip").setStyle(ColorStyle.GRAY));
}

@Override
public ActionResultType func_225533_a_(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult ray) {
if (world.isRemote) return ActionResultType.SUCCESS;
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileTransmutationInterface)
player.sendStatusMessage(new StringTextComponent(((TileTransmutationInterface) tile).ownerName), true);
return super.func_225533_a_(state, world, pos, player, hand, ray);
}

@Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, @Nullable LivingEntity livingEntity, ItemStack stack) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileTransmutationInterface)
((TileTransmutationInterface) tile).wasPlaced(livingEntity, stack);
}
}
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
package cool.furry.mc.forge.projectexpansion.init;

import cool.furry.mc.forge.projectexpansion.Main;
import cool.furry.mc.forge.projectexpansion.block.BlockArcaneTable;
import cool.furry.mc.forge.projectexpansion.block.BlockEMCExport;
import cool.furry.mc.forge.projectexpansion.block.BlockEMCImport;
import cool.furry.mc.forge.projectexpansion.block.BlockEMCLink;
import cool.furry.mc.forge.projectexpansion.block.*;
import net.minecraft.block.Block;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;

@SuppressWarnings("unused")
@Mod.EventBusSubscriber(modid = Main.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class Blocks {
public static final DeferredRegister<Block> Registry = DeferredRegister.create(ForgeRegistries.BLOCKS, Main.MOD_ID);

public static final RegistryObject<BlockArcaneTable> ARCANE_TABLE = Registry.register("arcane_table", BlockArcaneTable::new);
public static final RegistryObject<BlockEMCLink> EMC_LINK = Registry.register("emc_link", BlockEMCLink::new);
public static final RegistryObject<BlockEMCExport> EMC_EXPORT = Registry.register("emc_export", BlockEMCExport::new);
public static final RegistryObject<BlockEMCImport> EMC_IMPORT = Registry.register("emc_import", BlockEMCImport::new);
public static final RegistryObject<BlockTransmutationInterface> TRANSMUTATION_INTERFACE = Registry.register("transmutation_interface", BlockTransmutationInterface::new);
}
19 changes: 9 additions & 10 deletions src/main/java/cool/furry/mc/forge/projectexpansion/init/Items.java
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
package cool.furry.mc.forge.projectexpansion.init;

import cool.furry.mc.forge.projectexpansion.Main;
import cool.furry.mc.forge.projectexpansion.item.ItemArcaneTablet;
import cool.furry.mc.forge.projectexpansion.item.ItemFinalStar;
import cool.furry.mc.forge.projectexpansion.item.ItemUpgrade;
import cool.furry.mc.forge.projectexpansion.item.*;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.Rarity;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;

@SuppressWarnings("unused")
@Mod.EventBusSubscriber(modid = Main.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class Items {
public static final DeferredRegister<Item> Registry = DeferredRegister.create(ForgeRegistries.ITEMS, Main.MOD_ID);

public static final RegistryObject<Item> ARCANE_TABLET = Registry.register("arcane_tablet", ItemArcaneTablet::new);
public static final RegistryObject<Item> ARCANE_TABLE = Registry.register("arcane_table", () -> new BlockItem(Blocks.ARCANE_TABLE.get(), new Item.Properties().group(Main.group).rarity(Rarity.RARE)));
public static final RegistryObject<Item> EMC_LINK = Registry.register("emc_link", () -> new BlockItem(Blocks.EMC_LINK.get(), new Item.Properties().group(Main.group)));
public static final RegistryObject<BlockItem> ARCANE_TABLE = Registry.register("arcane_table", () -> new BlockItem(Blocks.ARCANE_TABLE.get(), new Item.Properties().group(Main.group).rarity(Rarity.RARE)));
public static final RegistryObject<BlockItem> EMC_LINK = Registry.register("emc_link", () -> new BlockItem(Blocks.EMC_LINK.get(), new Item.Properties().group(Main.group)));
;
public static final RegistryObject<BlockItem> EMC_EXPORT = Registry.register("emc_export", () -> new BlockItem(Blocks.EMC_EXPORT.get(), new Item.Properties().group(Main.group)));
public static final RegistryObject<BlockItem> EMC_IMPORT = Registry.register("emc_import", () -> new BlockItem(Blocks.EMC_IMPORT.get(), new Item.Properties().group(Main.group)));
public static final RegistryObject<Item> FINAL_STAR_SHARD = Registry.register("final_star_shard", () -> new Item(new Item.Properties().maxStackSize(1).rarity(Rarity.RARE).group(Main.group)));
public static final RegistryObject<Item> FINAL_STAR = Registry.register("final_star", ItemFinalStar::new);
public static final RegistryObject<BlockItem> EMC_EXPORT = Registry.register("emc_export", () -> new BlockItem(Blocks.EMC_EXPORT.get(), new Item.Properties().group(Main.group)));
public static final RegistryObject<BlockItem> EMC_Import = Registry.register("emc_import", () -> new BlockItem(Blocks.EMC_IMPORT.get(), new Item.Properties().group(Main.group)));
public static final RegistryObject<Item> MATTER_UPGRADER = Registry.register("matter_upgrader", ItemUpgrade::new);
public static final RegistryObject<Item> INFINITE_FUEL = Registry.register("infinite_fuel", ItemInfiniteFuel::new);
public static final RegistryObject<Item> INFINITE_STEAK = Registry.register("infinite_steak", ItemInfiniteSteak::new);
public static final RegistryObject<BlockItem> TRANSMUTATION_INTERFACE = Registry.register("transmutation_interface", () -> new BlockItem(Blocks.TRANSMUTATION_INTERFACE.get(), new Item.Properties().group(Main.group).rarity(Rarity.EPIC)));
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@
import net.minecraft.block.Block;
import net.minecraft.tileentity.TileEntityType;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;

import java.util.Arrays;

@SuppressWarnings("unused")
@Mod.EventBusSubscriber(modid = Main.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class TileEntityTypes {
public static final DeferredRegister<TileEntityType<?>> Registry = DeferredRegister.create(ForgeRegistries.TILE_ENTITIES, Main.MOD_ID);

Expand All @@ -23,4 +20,5 @@ public class TileEntityTypes {
public static final RegistryObject<TileEntityType<TileRelay>> ANTI_MATTER_RELAY = Registry.register("relay", () -> TileEntityType.Builder.create(TileRelay::new, Arrays.stream(Matter.VALUES).map(Matter::getRelay).toArray(Block[]::new)).build(null));
public static final RegistryObject<TileEntityType<TileEMCExport>> EMC_EXPORT = Registry.register("emc_export", () -> TileEntityType.Builder.create(TileEMCExport::new, Blocks.EMC_EXPORT.get()).build(null));
public static final RegistryObject<TileEntityType<TileEMCImport>> EMC_IMPORT = Registry.register("emc_import", () -> TileEntityType.Builder.create(TileEMCImport::new, Blocks.EMC_IMPORT.get()).build(null));
public static final RegistryObject<TileEntityType<TileTransmutationInterface>> TRANSMUTATION_INTERFACE = Registry.register("transmutation_interface", () -> TileEntityType.Builder.create(TileTransmutationInterface::new, Blocks.TRANSMUTATION_INTERFACE.get()).build(null));
}
Loading

0 comments on commit 955c1fa

Please sign in to comment.