1147 - Initial auto mappings pass
This commit is contained in:
parent
48198dbcb3
commit
4e03ac893c
291 changed files with 3335 additions and 3504 deletions
|
@ -24,17 +24,17 @@
|
|||
|
||||
package techreborn.events;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.tag.BlockTags;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
||||
|
||||
|
||||
import reborncore.common.registration.RebornRegister;
|
||||
import reborncore.common.registration.config.ConfigRegistry;
|
||||
import reborncore.common.util.OreDrop;
|
||||
|
@ -62,27 +62,27 @@ public class BlockBreakHandler {
|
|||
@SubscribeEvent
|
||||
public void onBlockHarvest(BlockEvent.HarvestDropsEvent event) {
|
||||
if (secondaryGemDrops && !event.isSilkTouching()) {
|
||||
IBlockState state = event.getState();
|
||||
BlockState state = event.getState();
|
||||
List<ItemStack> drops = event.getDrops();
|
||||
Random random = new Random();
|
||||
//TODO: fix tags
|
||||
if (state.getBlock().isIn(new BlockTags.Wrapper(new ResourceLocation(TechReborn.MOD_ID, "ruby_ore")))) {
|
||||
if (state.getBlock().matches(new BlockTags.CachingTag(new Identifier(TechReborn.MOD_ID, "ruby_ore")))) {
|
||||
OreDrop redGarnet = new OreDrop(TRContent.Gems.RED_GARNET.getStack(), redGarnetDropChance, 1);
|
||||
drops.add(redGarnet.getDrops(event.getFortuneLevel(), random));
|
||||
}
|
||||
else if (state.getBlock().isIn(new BlockTags.Wrapper(new ResourceLocation(TechReborn.MOD_ID, "sapphire_ore")))) {
|
||||
else if (state.getBlock().matches(new BlockTags.CachingTag(new Identifier(TechReborn.MOD_ID, "sapphire_ore")))) {
|
||||
OreDrop peridot = new OreDrop(TRContent.Gems.PERIDOT.getStack(), peridotDropChance, 1);
|
||||
drops.add(peridot.getDrops(event.getFortuneLevel(), random));
|
||||
}
|
||||
else if (state.getBlock().isIn(new BlockTags.Wrapper(new ResourceLocation(TechReborn.MOD_ID, "sodalite_ore")))) {
|
||||
else if (state.getBlock().matches(new BlockTags.CachingTag(new Identifier(TechReborn.MOD_ID, "sodalite_ore")))) {
|
||||
OreDrop aluminium = new OreDrop(TRContent.Dusts.ALUMINUM.getStack(), aluminiumDropChance, 1);
|
||||
drops.add(aluminium.getDrops(event.getFortuneLevel(), random));
|
||||
}
|
||||
else if (state.getBlock().isIn(new BlockTags.Wrapper(new ResourceLocation(TechReborn.MOD_ID, "cinnabar_ore")))) {
|
||||
else if (state.getBlock().matches(new BlockTags.CachingTag(new Identifier(TechReborn.MOD_ID, "cinnabar_ore")))) {
|
||||
OreDrop redstone = new OreDrop(new ItemStack(Items.REDSTONE), redstoneDropChance, 1);
|
||||
drops.add(redstone.getDrops(event.getFortuneLevel(), random));
|
||||
}
|
||||
else if (state.getBlock().isIn(new BlockTags.Wrapper(new ResourceLocation(TechReborn.MOD_ID, "sphalerite_ore")))) {
|
||||
else if (state.getBlock().matches(new BlockTags.CachingTag(new Identifier(TechReborn.MOD_ID, "sphalerite_ore")))) {
|
||||
OreDrop yellowGarnet = new OreDrop(TRContent.Gems.YELLOW_GARNET.getStack(), yellowGarnetDropChance, 1);
|
||||
drops.add(yellowGarnet.getDrops(event.getFortuneLevel(), random));
|
||||
}
|
||||
|
@ -91,15 +91,15 @@ public class BlockBreakHandler {
|
|||
|
||||
@SubscribeEvent
|
||||
public void getBreakSpeedEvent(PlayerEvent.BreakSpeed event){
|
||||
if(event.getEntityPlayer().getHeldItem(EnumHand.MAIN_HAND).getItem() == TRContent.INDUSTRIAL_CHAINSAW && event.getOriginalSpeed() > 1.0f){
|
||||
if(event.getEntityPlayer().getHeldItem(Hand.MAIN_HAND).getItem() == TRContent.INDUSTRIAL_CHAINSAW && event.getOriginalSpeed() > 1.0f){
|
||||
BlockPos pos = event.getPos();
|
||||
World worldIn = event.getEntityPlayer().world;
|
||||
float speed = 20F;
|
||||
int blocks = 0;
|
||||
for (int i = 1; i < 10; i++) {
|
||||
BlockPos nextPos = pos.up(i);
|
||||
IBlockState nextState = worldIn.getBlockState(nextPos);
|
||||
if(nextState.getBlock().isIn(BlockTags.LOGS)){
|
||||
BlockState nextState = worldIn.getBlockState(nextPos);
|
||||
if(nextState.getBlock().matches(BlockTags.LOGS)){
|
||||
blocks ++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,12 +25,12 @@
|
|||
package techreborn.events;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
|
||||
|
||||
import reborncore.client.models.ModelCompound;
|
||||
import reborncore.client.models.RebornModelRegistry;
|
||||
import techreborn.TechReborn;
|
||||
|
@ -45,7 +45,7 @@ import java.util.Arrays;
|
|||
* @author drcrazy
|
||||
*
|
||||
*/
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Environment(EnvType.CLIENT)
|
||||
@Mod.EventBusSubscriber(modid = TechReborn.MOD_ID)
|
||||
public class ModelRegistryEventHandler {
|
||||
|
||||
|
@ -174,7 +174,7 @@ public class ModelRegistryEventHandler {
|
|||
|
||||
// Gem armor & tools
|
||||
if (ConfigTechReborn.enableGemArmorAndTools) {
|
||||
ResourceLocation armourRL = new ResourceLocation(TechReborn.MOD_ID, "items/armour");
|
||||
Identifier armourRL = new Identifier(TechReborn.MOD_ID, "items/armour");
|
||||
registerBlockstateMultiItem(armourRL, TRContent.RUBY_HELMET, "ruby_helmet");
|
||||
registerBlockstateMultiItem(armourRL, TRContent.RUBY_CHESTPLATE, "ruby_chestplate");
|
||||
registerBlockstateMultiItem(armourRL, TRContent.RUBY_LEGGINGS, "ruby_leggings");
|
||||
|
@ -192,7 +192,7 @@ public class ModelRegistryEventHandler {
|
|||
registerBlockstateMultiItem(armourRL, TRContent.BRONZE_LEGGINGS, "bronze_leggings");
|
||||
registerBlockstateMultiItem(armourRL, TRContent.BRONZE_BOOTS, "bronze_boots");
|
||||
|
||||
ResourceLocation toolRL = new ResourceLocation(TechReborn.MOD_ID, "items/tool");
|
||||
Identifier toolRL = new Identifier(TechReborn.MOD_ID, "items/tool");
|
||||
registerBlockstateMultiItem(toolRL, TRContent.RUBY_PICKAXE, "ruby_pickaxe");
|
||||
registerBlockstateMultiItem(toolRL, TRContent.RUBY_SWORD, "ruby_sword");
|
||||
registerBlockstateMultiItem(toolRL, TRContent.RUBY_AXE, "ruby_axe");
|
||||
|
@ -215,28 +215,28 @@ public class ModelRegistryEventHandler {
|
|||
registerBlockstateMultiItem(toolRL, TRContent.BRONZE_HOE, "bronze_hoe");
|
||||
}
|
||||
|
||||
ResourceLocation dustsRL = new ResourceLocation(TechReborn.MOD_ID, "items/material/dust");
|
||||
Identifier dustsRL = new Identifier(TechReborn.MOD_ID, "items/material/dust");
|
||||
Arrays.stream(Dusts.values()).forEach(value -> registerBlockstateMultiItem(dustsRL, value.item, value.name));
|
||||
|
||||
ResourceLocation dustsSmallRL = new ResourceLocation(TechReborn.MOD_ID, "items/material/small_dust");
|
||||
Identifier dustsSmallRL = new Identifier(TechReborn.MOD_ID, "items/material/small_dust");
|
||||
Arrays.stream(SmallDusts.values()).forEach(value -> registerBlockstateMultiItem(dustsSmallRL, value.item, value.name));
|
||||
|
||||
ResourceLocation gemsRL = new ResourceLocation(TechReborn.MOD_ID, "items/material/gem");
|
||||
Identifier gemsRL = new Identifier(TechReborn.MOD_ID, "items/material/gem");
|
||||
Arrays.stream(Gems.values()).forEach(value -> registerBlockstateMultiItem(gemsRL, value.item, value.name));
|
||||
|
||||
ResourceLocation ingotsRL = new ResourceLocation(TechReborn.MOD_ID, "items/material/ingot");
|
||||
Identifier ingotsRL = new Identifier(TechReborn.MOD_ID, "items/material/ingot");
|
||||
Arrays.stream(Ingots.values()).forEach(value -> registerBlockstateMultiItem(ingotsRL, value.item, value.name));
|
||||
|
||||
ResourceLocation nuggetsRL = new ResourceLocation(TechReborn.MOD_ID, "items/material/nugget");
|
||||
Identifier nuggetsRL = new Identifier(TechReborn.MOD_ID, "items/material/nugget");
|
||||
Arrays.stream(Nuggets.values()).forEach(value -> registerBlockstateMultiItem(nuggetsRL, value.item, value.name));
|
||||
|
||||
ResourceLocation partsRL = new ResourceLocation(TechReborn.MOD_ID, "items/material/part");
|
||||
Identifier partsRL = new Identifier(TechReborn.MOD_ID, "items/material/part");
|
||||
Arrays.stream(Parts.values()).forEach(value -> registerBlockstateMultiItem(partsRL, value.item, value.name));
|
||||
|
||||
ResourceLocation platesRL = new ResourceLocation(TechReborn.MOD_ID, "items/material/plate");
|
||||
Identifier platesRL = new Identifier(TechReborn.MOD_ID, "items/material/plate");
|
||||
Arrays.stream(Plates.values()).forEach(value -> registerBlockstateMultiItem(platesRL, value.item, value.name));
|
||||
|
||||
ResourceLocation upgradeRL = new ResourceLocation(TechReborn.MOD_ID, "items/misc/upgrades");
|
||||
Identifier upgradeRL = new Identifier(TechReborn.MOD_ID, "items/misc/upgrades");
|
||||
Arrays.stream(Upgrades.values()).forEach(value -> registerBlockstateMultiItem(upgradeRL, value.item, value.name));
|
||||
|
||||
}
|
||||
|
@ -270,7 +270,7 @@ public class ModelRegistryEventHandler {
|
|||
RebornModelRegistry.registerItemModel(item, modelPath);
|
||||
}
|
||||
|
||||
private static void registerBlockstateMultiItem(ResourceLocation RL, Item item, String variantName) {
|
||||
private static void registerBlockstateMultiItem(Identifier RL, Item item, String variantName) {
|
||||
//ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(RL, "type=" + variantName));
|
||||
}
|
||||
|
||||
|
|
|
@ -25,16 +25,16 @@
|
|||
package techreborn.events;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
|
||||
|
||||
|
||||
import reborncore.RebornRegistry;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
import reborncore.common.util.BucketHandler;
|
||||
|
@ -88,29 +88,29 @@ public class RegistryEventHandler {
|
|||
|
||||
@SubscribeEvent
|
||||
public static void registerBlocks(RegistryEvent.Register<Block> event) {
|
||||
Arrays.stream(Ores.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Properties().group(TechReborn.ITEMGROUP)));
|
||||
Arrays.stream(StorageBlocks.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Properties().group(TechReborn.ITEMGROUP)));
|
||||
Arrays.stream(Ores.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Settings().itemGroup(TechReborn.ITEMGROUP)));
|
||||
Arrays.stream(StorageBlocks.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Settings().itemGroup(TechReborn.ITEMGROUP)));
|
||||
Arrays.stream(MachineBlocks.values()).forEach(value -> {
|
||||
RebornRegistry.registerBlock(value.frame, new Item.Properties().group(TechReborn.ITEMGROUP));
|
||||
RebornRegistry.registerBlock(value.casing, new Item.Properties().group(TechReborn.ITEMGROUP));
|
||||
RebornRegistry.registerBlock(value.frame, new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
|
||||
RebornRegistry.registerBlock(value.casing, new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
|
||||
});
|
||||
Arrays.stream(SolarPanels.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Properties().group(TechReborn.ITEMGROUP)));
|
||||
Arrays.stream(Cables.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Properties().group(TechReborn.ITEMGROUP)));
|
||||
Arrays.stream(Machine.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Properties().group(TechReborn.ITEMGROUP)));
|
||||
Arrays.stream(SolarPanels.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Settings().itemGroup(TechReborn.ITEMGROUP)));
|
||||
Arrays.stream(Cables.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Settings().itemGroup(TechReborn.ITEMGROUP)));
|
||||
Arrays.stream(Machine.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Settings().itemGroup(TechReborn.ITEMGROUP)));
|
||||
|
||||
// Misc. blocks
|
||||
RebornRegistry.registerBlock(TRContent.COMPUTER_CUBE = InitUtils.setup(new BlockComputerCube(), "computer_cube"), new Item.Properties().group(TechReborn.ITEMGROUP));
|
||||
RebornRegistry.registerBlock(TRContent.NUKE = InitUtils.setup(new BlockNuke(), "nuke"), new Item.Properties().group(TechReborn.ITEMGROUP));
|
||||
RebornRegistry.registerBlock(TRContent.REFINED_IRON_FENCE = InitUtils.setup(new BlockRefinedIronFence(), "refined_iron_fence"), new Item.Properties().group(TechReborn.ITEMGROUP));
|
||||
RebornRegistry.registerBlock(TRContent.REINFORCED_GLASS = InitUtils.setup(new BlockReinforcedGlass(), "reinforced_glass"), new Item.Properties().group(TechReborn.ITEMGROUP));
|
||||
RebornRegistry.registerBlock(TRContent.RUBBER_LEAVES = InitUtils.setup(new BlockRubberLeaves(), "rubber_leaves"), new Item.Properties().group(TechReborn.ITEMGROUP));
|
||||
RebornRegistry.registerBlock(TRContent.RUBBER_LOG = InitUtils.setup(new BlockRubberLog(), "rubber_log"), new Item.Properties().group(TechReborn.ITEMGROUP));
|
||||
RebornRegistry.registerBlock(TRContent.RUBBER_PLANKS = InitUtils.setup(new BlockRubberPlank(), "rubber_planks"), new Item.Properties().group(TechReborn.ITEMGROUP));
|
||||
RebornRegistry.registerBlock(TRContent.COMPUTER_CUBE = InitUtils.setup(new BlockComputerCube(), "computer_cube"), new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
|
||||
RebornRegistry.registerBlock(TRContent.NUKE = InitUtils.setup(new BlockNuke(), "nuke"), new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
|
||||
RebornRegistry.registerBlock(TRContent.REFINED_IRON_FENCE = InitUtils.setup(new BlockRefinedIronFence(), "refined_iron_fence"), new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
|
||||
RebornRegistry.registerBlock(TRContent.REINFORCED_GLASS = InitUtils.setup(new BlockReinforcedGlass(), "reinforced_glass"), new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
|
||||
RebornRegistry.registerBlock(TRContent.RUBBER_LEAVES = InitUtils.setup(new BlockRubberLeaves(), "rubber_leaves"), new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
|
||||
RebornRegistry.registerBlock(TRContent.RUBBER_LOG = InitUtils.setup(new BlockRubberLog(), "rubber_log"), new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
|
||||
RebornRegistry.registerBlock(TRContent.RUBBER_PLANKS = InitUtils.setup(new BlockRubberPlank(), "rubber_planks"), new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
|
||||
RebornRegistry.registerBlock(TRContent.RUBBER_SAPLING = InitUtils.setup(new BlockRubberSapling(), "rubber_sapling"),
|
||||
ItemBlockRubberSapling.class,
|
||||
"rubber_sapling");
|
||||
RebornRegistry.registerBlock(TRContent.RUBBER_PLANK_SLAB = InitUtils.setup(new BlockRubberPlankSlab(), "rubber_plank_slab"), new Item.Properties().group(TechReborn.ITEMGROUP));
|
||||
RebornRegistry.registerBlock(TRContent.RUBBER_PLANK_STAIR = InitUtils.setup(new BlockRubberPlankStair(), "rubber_plank_stair"), new Item.Properties().group(TechReborn.ITEMGROUP));
|
||||
RebornRegistry.registerBlock(TRContent.RUBBER_PLANK_SLAB = InitUtils.setup(new BlockRubberPlankSlab(), "rubber_plank_slab"), new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
|
||||
RebornRegistry.registerBlock(TRContent.RUBBER_PLANK_STAIR = InitUtils.setup(new BlockRubberPlankStair(), "rubber_plank_stair"), new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
|
||||
|
||||
TechReborn.LOGGER.debug("TechReborns Blocks Loaded");
|
||||
}
|
||||
|
@ -135,10 +135,10 @@ public class RegistryEventHandler {
|
|||
RebornRegistry.registerItem(TRContent.BRONZE_AXE = InitUtils.setup(new ItemTRAxe(TRToolTier.BRONZE, "ingotBronze"), "bronze_axe"));
|
||||
RebornRegistry.registerItem(TRContent.BRONZE_HOE = InitUtils.setup(new ItemTRHoe(TRToolTier.BRONZE, "ingotBronze"), "bronze_hoe"));
|
||||
|
||||
RebornRegistry.registerItem(TRContent.BRONZE_HELMET = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.BRONZE, EntityEquipmentSlot.HEAD, "ingotBronze"), "bronze_helmet"));
|
||||
RebornRegistry.registerItem(TRContent.BRONZE_CHESTPLATE = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.BRONZE, EntityEquipmentSlot.CHEST, "ingotBronze"), "bronze_chestplate"));
|
||||
RebornRegistry.registerItem(TRContent.BRONZE_LEGGINGS = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.BRONZE, EntityEquipmentSlot.LEGS, "ingotBronze"), "bronze_leggings"));
|
||||
RebornRegistry.registerItem(TRContent.BRONZE_BOOTS = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.BRONZE, EntityEquipmentSlot.FEET, "ingotBronze"), "bronze_boots"));
|
||||
RebornRegistry.registerItem(TRContent.BRONZE_HELMET = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.BRONZE, EquipmentSlot.HEAD, "ingotBronze"), "bronze_helmet"));
|
||||
RebornRegistry.registerItem(TRContent.BRONZE_CHESTPLATE = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.BRONZE, EquipmentSlot.CHEST, "ingotBronze"), "bronze_chestplate"));
|
||||
RebornRegistry.registerItem(TRContent.BRONZE_LEGGINGS = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.BRONZE, EquipmentSlot.LEGS, "ingotBronze"), "bronze_leggings"));
|
||||
RebornRegistry.registerItem(TRContent.BRONZE_BOOTS = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.BRONZE, EquipmentSlot.FEET, "ingotBronze"), "bronze_boots"));
|
||||
|
||||
RebornRegistry.registerItem(TRContent.RUBY_SWORD = InitUtils.setup(new ItemTRSword(TRToolTier.RUBY, "gemRuby"), "ruby_sword"));
|
||||
RebornRegistry.registerItem(TRContent.RUBY_PICKAXE = InitUtils.setup(new ItemTRPickaxe(TRToolTier.RUBY, "gemRuby"), "ruby_pickaxe"));
|
||||
|
@ -146,10 +146,10 @@ public class RegistryEventHandler {
|
|||
RebornRegistry.registerItem(TRContent.RUBY_AXE = InitUtils.setup(new ItemTRAxe(TRToolTier.RUBY, "gemRuby"), "ruby_axe"));
|
||||
RebornRegistry.registerItem(TRContent.RUBY_HOE = InitUtils.setup(new ItemTRHoe(TRToolTier.RUBY, "gemRuby"), "ruby_hoe"));
|
||||
|
||||
RebornRegistry.registerItem(TRContent.RUBY_HELMET = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.RUBY, EntityEquipmentSlot.HEAD, "gemRuby"), "ruby_helmet"));
|
||||
RebornRegistry.registerItem(TRContent.RUBY_CHESTPLATE = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.RUBY, EntityEquipmentSlot.CHEST, "gemRuby"), "ruby_chestplate"));
|
||||
RebornRegistry.registerItem(TRContent.RUBY_LEGGINGS = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.RUBY, EntityEquipmentSlot.LEGS, "gemRuby"), "ruby_leggings"));
|
||||
RebornRegistry.registerItem(TRContent.RUBY_BOOTS = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.RUBY, EntityEquipmentSlot.FEET, "gemRuby"), "ruby_boots"));
|
||||
RebornRegistry.registerItem(TRContent.RUBY_HELMET = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.RUBY, EquipmentSlot.HEAD, "gemRuby"), "ruby_helmet"));
|
||||
RebornRegistry.registerItem(TRContent.RUBY_CHESTPLATE = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.RUBY, EquipmentSlot.CHEST, "gemRuby"), "ruby_chestplate"));
|
||||
RebornRegistry.registerItem(TRContent.RUBY_LEGGINGS = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.RUBY, EquipmentSlot.LEGS, "gemRuby"), "ruby_leggings"));
|
||||
RebornRegistry.registerItem(TRContent.RUBY_BOOTS = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.RUBY, EquipmentSlot.FEET, "gemRuby"), "ruby_boots"));
|
||||
|
||||
RebornRegistry.registerItem(TRContent.SAPPHIRE_SWORD = InitUtils.setup(new ItemTRSword(TRToolTier.SAPPHIRE, "gemSapphire"), "sapphire_sword"));
|
||||
RebornRegistry.registerItem(TRContent.SAPPHIRE_PICKAXE = InitUtils.setup(new ItemTRPickaxe(TRToolTier.SAPPHIRE, "gemSapphire"), "sapphire_pickaxe"));
|
||||
|
@ -157,10 +157,10 @@ public class RegistryEventHandler {
|
|||
RebornRegistry.registerItem(TRContent.SAPPHIRE_AXE = InitUtils.setup(new ItemTRAxe(TRToolTier.SAPPHIRE, "gemSapphire"), "sapphire_axe"));
|
||||
RebornRegistry.registerItem(TRContent.SAPPHIRE_HOE = InitUtils.setup(new ItemTRHoe(TRToolTier.SAPPHIRE, "gemSapphire"), "sapphire_hoe"));
|
||||
|
||||
RebornRegistry.registerItem(TRContent.SAPPHIRE_HELMET = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.SAPPHIRE, EntityEquipmentSlot.HEAD, "gemSapphire"), "sapphire_helmet"));
|
||||
RebornRegistry.registerItem(TRContent.SAPPHIRE_CHESTPLATE = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.SAPPHIRE, EntityEquipmentSlot.CHEST, "gemSapphire"), "sapphire_chestplate"));
|
||||
RebornRegistry.registerItem(TRContent.SAPPHIRE_LEGGINGS = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.SAPPHIRE, EntityEquipmentSlot.LEGS, "gemSapphire"), "sapphire_leggings"));
|
||||
RebornRegistry.registerItem(TRContent.SAPPHIRE_BOOTS = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.SAPPHIRE, EntityEquipmentSlot.FEET, "gemSapphire"), "sapphire_boots"));
|
||||
RebornRegistry.registerItem(TRContent.SAPPHIRE_HELMET = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.SAPPHIRE, EquipmentSlot.HEAD, "gemSapphire"), "sapphire_helmet"));
|
||||
RebornRegistry.registerItem(TRContent.SAPPHIRE_CHESTPLATE = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.SAPPHIRE, EquipmentSlot.CHEST, "gemSapphire"), "sapphire_chestplate"));
|
||||
RebornRegistry.registerItem(TRContent.SAPPHIRE_LEGGINGS = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.SAPPHIRE, EquipmentSlot.LEGS, "gemSapphire"), "sapphire_leggings"));
|
||||
RebornRegistry.registerItem(TRContent.SAPPHIRE_BOOTS = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.SAPPHIRE, EquipmentSlot.FEET, "gemSapphire"), "sapphire_boots"));
|
||||
|
||||
RebornRegistry.registerItem(TRContent.PERIDOT_SWORD = InitUtils.setup(new ItemTRSword(TRToolTier.PERIDOT, "gemPeridot"), "peridot_sword"));
|
||||
RebornRegistry.registerItem(TRContent.PERIDOT_PICKAXE = InitUtils.setup(new ItemTRPickaxe(TRToolTier.PERIDOT, "gemPeridot"), "peridot_pickaxe"));
|
||||
|
@ -168,10 +168,10 @@ public class RegistryEventHandler {
|
|||
RebornRegistry.registerItem(TRContent.PERIDOT_AXE = InitUtils.setup(new ItemTRAxe(TRToolTier.PERIDOT, "gemPeridot"), "peridot_axe"));
|
||||
RebornRegistry.registerItem(TRContent.PERIDOT_HOE = InitUtils.setup(new ItemTRHoe(TRToolTier.PERIDOT, "gemPeridot"), "peridot_hoe"));
|
||||
|
||||
RebornRegistry.registerItem(TRContent.PERIDOT_HELMET = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.PERIDOT, EntityEquipmentSlot.HEAD, "gemPeridot"), "peridot_helmet"));
|
||||
RebornRegistry.registerItem(TRContent.PERIDOT_CHESTPLATE = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.PERIDOT, EntityEquipmentSlot.CHEST, "gemPeridot"), "peridot_chestplate"));
|
||||
RebornRegistry.registerItem(TRContent.PERIDOT_LEGGINGS = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.PERIDOT, EntityEquipmentSlot.LEGS, "gemPeridot"), "peridot_leggings"));
|
||||
RebornRegistry.registerItem(TRContent.PERIDOT_BOOTS = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.PERIDOT, EntityEquipmentSlot.FEET, "gemPeridot"), "peridot_boots"));
|
||||
RebornRegistry.registerItem(TRContent.PERIDOT_HELMET = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.PERIDOT, EquipmentSlot.HEAD, "gemPeridot"), "peridot_helmet"));
|
||||
RebornRegistry.registerItem(TRContent.PERIDOT_CHESTPLATE = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.PERIDOT, EquipmentSlot.CHEST, "gemPeridot"), "peridot_chestplate"));
|
||||
RebornRegistry.registerItem(TRContent.PERIDOT_LEGGINGS = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.PERIDOT, EquipmentSlot.LEGS, "gemPeridot"), "peridot_leggings"));
|
||||
RebornRegistry.registerItem(TRContent.PERIDOT_BOOTS = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.PERIDOT, EquipmentSlot.FEET, "gemPeridot"), "peridot_boots"));
|
||||
}
|
||||
|
||||
// Battery
|
||||
|
@ -222,7 +222,7 @@ public class RegistryEventHandler {
|
|||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerTiles(RegistryEvent.Register<TileEntityType<?>> event) {
|
||||
public static void registerTiles(RegistryEvent.Register<BlockEntityType<?>> event) {
|
||||
TRTileEntities.TYPES.forEach(tileEntityType -> event.getRegistry().register(tileEntityType));
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,7 @@ public class RegistryEventHandler {
|
|||
@SubscribeEvent
|
||||
public static void registerEntityTypes(RegistryEvent.Register<EntityType<?>> event) {
|
||||
TRContent.ENTITY_NUKE = EntityType.Builder.create(EntityNukePrimed.class, EntityNukePrimed::new).build("nuke");
|
||||
TRContent.ENTITY_NUKE.setRegistryName(new ResourceLocation(TechReborn.MOD_ID, "nuke"));
|
||||
TRContent.ENTITY_NUKE.setRegistryName(new Identifier(TechReborn.MOD_ID, "nuke"));
|
||||
event.getRegistry().register(TRContent.ENTITY_NUKE);
|
||||
|
||||
}
|
||||
|
|
|
@ -24,21 +24,21 @@
|
|||
|
||||
package techreborn.events;
|
||||
|
||||
import net.minecraft.ChatFormat;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.util.InputMappings;
|
||||
import net.minecraft.block.BlockEntityProvider;
|
||||
import net.minecraft.block.BlockWithEntity;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.util.InputUtil;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
|
||||
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
|
@ -51,7 +51,7 @@ import techreborn.TechReborn;
|
|||
public class StackToolTipEvent {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Environment(EnvType.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void handleItemTooltipEvent(ItemTooltipEvent event) {
|
||||
if (event.getEntityPlayer() == null) {
|
||||
|
@ -62,41 +62,41 @@ public class StackToolTipEvent {
|
|||
((IListInfoProvider) item).addInfo(event.getToolTip(), false, false);
|
||||
} else if (event.getItemStack().getItem() instanceof IEnergyItemInfo) {
|
||||
IEnergyStorage capEnergy = new ForgePowerItemManager(event.getItemStack());
|
||||
TextComponentString line1 = new TextComponentString(PowerSystem
|
||||
TextComponent line1 = new TextComponent(PowerSystem
|
||||
.getLocaliszedPowerFormattedNoSuffix(capEnergy.getEnergyStored() / RebornCoreConfig.euPerFU));
|
||||
line1.appendText("/");
|
||||
line1.appendText(PowerSystem
|
||||
line1.append("/");
|
||||
line1.append(PowerSystem
|
||||
.getLocaliszedPowerFormattedNoSuffix(capEnergy.getMaxEnergyStored() / RebornCoreConfig.euPerFU));
|
||||
line1.appendText(" ");
|
||||
line1.appendText(PowerSystem.getDisplayPower().abbreviation);
|
||||
line1.applyTextStyle(TextFormatting.GOLD);
|
||||
line1.append(" ");
|
||||
line1.append(PowerSystem.getDisplayPower().abbreviation);
|
||||
line1.applyFormat(ChatFormat.GOLD);
|
||||
|
||||
event.getToolTip().add(1, line1);
|
||||
|
||||
if (InputMappings.isKeyDown(GLFW.GLFW_KEY_LEFT_SHIFT)
|
||||
|| InputMappings.isKeyDown(GLFW.GLFW_KEY_RIGHT_SHIFT)) {
|
||||
if (InputUtil.isKeyDown(GLFW.GLFW_KEY_LEFT_SHIFT)
|
||||
|| InputUtil.isKeyDown(GLFW.GLFW_KEY_RIGHT_SHIFT)) {
|
||||
int percentage = percentage(capEnergy.getMaxEnergyStored(), capEnergy.getEnergyStored());
|
||||
TextFormatting color = StringUtils.getPercentageColour(percentage);
|
||||
ChatFormat color = StringUtils.getPercentageColour(percentage);
|
||||
event.getToolTip().add(2,
|
||||
new TextComponentString(color + "" + percentage + "%" + TextFormatting.GRAY + " Charged"));
|
||||
new TextComponent(color + "" + percentage + "%" + ChatFormat.GRAY + " Charged"));
|
||||
// TODO: show both input and output rates
|
||||
event.getToolTip().add(3, new TextComponentString(TextFormatting.GRAY + "I/O Rate: "
|
||||
+ TextFormatting.GOLD
|
||||
event.getToolTip().add(3, new TextComponent(ChatFormat.GRAY + "I/O Rate: "
|
||||
+ ChatFormat.GOLD
|
||||
+ PowerSystem.getLocaliszedPowerFormatted((int) ((IEnergyItemInfo) item).getMaxInput())));
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
Block block = Block.getBlockFromItem(item);
|
||||
if (block != null && (block instanceof BlockContainer || block instanceof ITileEntityProvider)
|
||||
if (block != null && (block instanceof BlockWithEntity || block instanceof BlockEntityProvider)
|
||||
&& block.getRegistryName().getNamespace().contains("techreborn")) {
|
||||
TileEntity tile = block.createTileEntity(block.getDefaultState(), Minecraft.getInstance().world);
|
||||
BlockEntity tile = block.createTileEntity(block.getDefaultState(), MinecraftClient.getInstance().world);
|
||||
boolean hasData = false;
|
||||
if (event.getItemStack().hasTag() && event.getItemStack().getTag().contains("tile_data")) {
|
||||
NBTTagCompound tileData = event.getItemStack().getTag().getCompound("tile_data");
|
||||
tile.read(tileData);
|
||||
CompoundTag tileData = event.getItemStack().getTag().getCompound("tile_data");
|
||||
tile.fromTag(tileData);
|
||||
hasData = true;
|
||||
event.getToolTip()
|
||||
.add(new TextComponentString("Block data contained").applyTextStyle(TextFormatting.DARK_GREEN));
|
||||
.add(new TextComponent("Block data contained").applyFormat(ChatFormat.DARK_GREEN));
|
||||
}
|
||||
if (tile instanceof IListInfoProvider) {
|
||||
((IListInfoProvider) tile).addInfo(event.getToolTip(), false, hasData);
|
||||
|
|
|
@ -24,17 +24,17 @@
|
|||
|
||||
package techreborn.events;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.recipe.Ingredient;
|
||||
import net.minecraft.recipe.Recipe;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.crafting.RecipeType;
|
||||
import net.minecraftforge.common.crafting.VanillaRecipeTypes;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.init.TRContent;
|
||||
|
@ -59,10 +59,10 @@ public class TRRecipeHandler {
|
|||
return;
|
||||
}
|
||||
World world = entityItemPickupEvent.getItem().world;
|
||||
if (entityItemPickupEvent.getEntityPlayer() instanceof EntityPlayerMP) {
|
||||
if (entityItemPickupEvent.getEntityPlayer() instanceof ServerPlayerEntity) {
|
||||
if (ItemUtils.isInputEqual("logWood", entityItemPickupEvent.getItem().getItem(), false, true)) {
|
||||
for (IRecipe recipe : world.getRecipeManager().getRecipes()) {
|
||||
if (recipe.getRecipeOutput().getItem() == TRContent.TREE_TAP) {
|
||||
for (Recipe recipe : world.getRecipeManager().getRecipes()) {
|
||||
if (recipe.getOutput().getItem() == TRContent.TREE_TAP) {
|
||||
entityItemPickupEvent.getEntityPlayer().unlockRecipes(Collections.singletonList(recipe));
|
||||
}
|
||||
}
|
||||
|
@ -70,9 +70,9 @@ public class TRRecipeHandler {
|
|||
}
|
||||
}
|
||||
|
||||
public static void unlockTRRecipes(EntityPlayerMP playerMP) {
|
||||
List<IRecipe> recipeList = new ArrayList<>();
|
||||
for (IRecipe recipe : getRecipes(playerMP.world, VanillaRecipeTypes.CRAFTING)) {
|
||||
public static void unlockTRRecipes(ServerPlayerEntity playerMP) {
|
||||
List<Recipe> recipeList = new ArrayList<>();
|
||||
for (Recipe recipe : getRecipes(playerMP.world, VanillaRecipeTypes.CRAFTING)) {
|
||||
if (isRecipeValid(recipe)) {
|
||||
recipeList.add(recipe);
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ public class TRRecipeHandler {
|
|||
playerMP.unlockRecipes(recipeList);
|
||||
}
|
||||
|
||||
public static <T extends IRecipe> List<IRecipe> getRecipes(World world, RecipeType<T> type){
|
||||
public static <T extends Recipe> List<Recipe> getRecipes(World world, RecipeType<T> type){
|
||||
return world.getRecipeManager().getRecipes().stream().filter(iRecipe -> iRecipe.getType() == type).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
@ -89,30 +89,30 @@ public class TRRecipeHandler {
|
|||
* Used to get the matching output of a recipe type that only has 1 input
|
||||
*
|
||||
*/
|
||||
public static <T extends IRecipe> ItemStack getMatchingRecipes(World world, RecipeType<T> type, ItemStack input){
|
||||
public static <T extends Recipe> ItemStack getMatchingRecipes(World world, RecipeType<T> type, ItemStack input){
|
||||
return getRecipes(world, type).stream()
|
||||
.filter(iRecipe -> iRecipe.getIngredients().size() == 1 && iRecipe.getIngredients().get(0).test(input))
|
||||
.map(IRecipe::getRecipeOutput)
|
||||
.map(Recipe::getRecipeOutput)
|
||||
.findFirst()
|
||||
.orElse(ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
private static boolean isRecipeValid(IRecipe recipe) {
|
||||
private static boolean isRecipeValid(Recipe recipe) {
|
||||
if (recipe.getId() == null) {
|
||||
return false;
|
||||
}
|
||||
if (!recipe.getId().getNamespace().equals(TechReborn.MOD_ID)) {
|
||||
return false;
|
||||
}
|
||||
if (!recipe.getRecipeOutput().getItem().getRegistryName().getNamespace().equals(TechReborn.MOD_ID)) {
|
||||
if (!recipe.getOutput().getItem().getRegistryName().getNamespace().equals(TechReborn.MOD_ID)) {
|
||||
return false;
|
||||
}
|
||||
// if (hiddenEntrys.contains(recipe.getRecipeOutput().getItem())) {
|
||||
// return false;
|
||||
// }
|
||||
//Hide uu recipes
|
||||
for (Ingredient ingredient : recipe.getIngredients()) {
|
||||
if (ingredient.test(TRContent.Parts.UU_MATTER.getStack())) {
|
||||
for (Ingredient ingredient : recipe.getPreviewInputs()) {
|
||||
if (ingredient.method_8093(TRContent.Parts.UU_MATTER.getStack())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,13 +24,13 @@
|
|||
|
||||
package techreborn.events;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.entity.effect.StatusEffects;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
|
||||
|
||||
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
public class TRTickHandler {
|
||||
|
@ -39,12 +39,12 @@ public class TRTickHandler {
|
|||
|
||||
@SubscribeEvent(priority = EventPriority.NORMAL, receiveCanceled = true)
|
||||
public void onPlayerTick(TickEvent.PlayerTickEvent e) {
|
||||
EntityPlayer player = e.player;
|
||||
Item chestslot = !player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isEmpty()
|
||||
? player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).getItem() : null;
|
||||
PlayerEntity player = e.player;
|
||||
Item chestslot = !player.getEquippedStack(EquipmentSlot.CHEST).isEmpty()
|
||||
? player.getEquippedStack(EquipmentSlot.CHEST).getItem() : null;
|
||||
|
||||
if (previouslyWearing != chestslot && previouslyWearing == TRContent.CLOAKING_DEVICE && player.isInvisible()
|
||||
&& !player.isPotionActive(MobEffects.INVISIBILITY)) {
|
||||
&& !player.hasStatusEffect(StatusEffects.INVISIBILITY)) {
|
||||
player.setInvisible(false);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue