The registry super purge

- Removed old Advancement managers
- Removed all unfinished logistical features from the registry
- Added new Crafting ingredients
- Added Sand Paper, for a polishing recipe type and repairing tools
- Changed Blockzapper materials
- Added the ability to include catalyst-ingredients in processing recipes
- Added some ingredient/output count validation for processing recipes
- Deployers now spawn particles when using certain items
- Players can now interact with the deployer to swap held items
- Belts now accept brass casing instead of logistical casing
- Introduced a new material chain
- Added a whole bunch of recipes
This commit is contained in:
simibubi 2020-01-26 23:58:55 +01:00
parent 39cbf77457
commit eff0c170b6
258 changed files with 1830 additions and 715 deletions

View file

@ -1,52 +0,0 @@
package com.simibubi.create;
import net.minecraft.advancements.AdvancementManager;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.event.entity.player.AdvancementEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
@EventBusSubscriber
public class AdvancementListener {
@SubscribeEvent
public static void onAdvancementGet(AdvancementEvent event) {
PlayerEntity player = event.getPlayer();
if (player == null)
return;
if (player.getServer() == null)
return;
// DEBUG
// AdvancementManager advancements = player.getServer().getAdvancementManager();
// player.sendMessage(new StringTextComponent(event.getAdvancement().getId().toString()));
unlockWhen("story/smelt_iron", recipeOf(AllItems.ANDESITE_ALLOY_CUBE), event);
unlockWhen("story/smelt_iron", recipeOf(AllItems.PLACEMENT_HANDGUN), event);
unlockWhen("nether/obtain_blaze_rod", recipeOf(AllItems.BLAZE_BRASS_CUBE), event);
unlockWhen("recipes/misc/popped_chorus_fruit", recipeOf(AllItems.CHORUS_CHROME_CUBE), event);
unlockWhen("recipes/decorations/end_rod", recipeOf(AllItems.SYMMETRY_WAND), event);
unlockWhen("recipes/misc/bone_meal", recipeOf(AllItems.TREE_FERTILIZER), event);
unlockWhen("recipes/misc/book", recipeOf(AllItems.EMPTY_BLUEPRINT), event);
unlockWhen("recipes/misc/book", recipeOf(AllItems.BLUEPRINT_AND_QUILL), event);
unlockWhen("recipes/misc/book", recipeOf(AllBlocks.SCHEMATIC_TABLE), event);
unlockWhen("recipes/misc/book", recipeOf(AllBlocks.SCHEMATICANNON), event);
}
private static void unlockWhen(String advancement, ResourceLocation recipe, AdvancementEvent event) {
AdvancementManager advancements = event.getPlayer().getServer().getAdvancementManager();
if (event.getAdvancement() == advancements.getAdvancement(new ResourceLocation(advancement)))
event.getPlayer().unlockRecipes(new ResourceLocation[] { recipe });
}
private static ResourceLocation recipeOf(AllItems item) {
return item.get().getRegistryName();
}
private static ResourceLocation recipeOf(AllBlocks block) {
return block.get().getRegistryName();
}
}

View file

@ -65,12 +65,6 @@ import com.simibubi.create.modules.logistics.block.extractor.LinkedExtractorBloc
import com.simibubi.create.modules.logistics.block.inventories.FlexcrateBlock;
import com.simibubi.create.modules.logistics.block.transposer.LinkedTransposerBlock;
import com.simibubi.create.modules.logistics.block.transposer.TransposerBlock;
import com.simibubi.create.modules.logistics.management.base.LogisticalControllerBlock;
import com.simibubi.create.modules.logistics.management.base.LogisticalControllerBlock.LogisticalControllerIndicatorBlock;
import com.simibubi.create.modules.logistics.management.base.NewLogisticalCasingBlock;
import com.simibubi.create.modules.logistics.management.index.LogisticalIndexBlock;
import com.simibubi.create.modules.logistics.transport.villager.LogisticiansTableBlock;
import com.simibubi.create.modules.logistics.transport.villager.PackageFunnelBlock;
import com.simibubi.create.modules.palettes.CTGlassBlock;
import com.simibubi.create.modules.palettes.GlassPaneBlock;
import com.simibubi.create.modules.palettes.LayeredCTBlock;
@ -196,13 +190,13 @@ public enum AllBlocks {
PULSE_REPEATER(new PulseRepeaterBlock()),
FLEXPEATER(new FlexpeaterBlock()),
FLEXPEATER_INDICATOR(new RenderUtilityBlock()),
LOGISTICAL_CASING(new NewLogisticalCasingBlock()),
LOGISTICAL_CONTROLLER(new LogisticalControllerBlock()),
LOGISTICAL_CONTROLLER_INDICATOR(new LogisticalControllerIndicatorBlock()),
LOGISTICAL_INDEX(new LogisticalIndexBlock()),
PACKAGE_FUNNEL(new PackageFunnelBlock()),
LOGISTICIANS_TABLE(new LogisticiansTableBlock()),
LOGISTICIANS_TABLE_INDICATOR(new RenderUtilityBlock()),
// LOGISTICAL_CASING(new NewLogisticalCasingBlock()),
// LOGISTICAL_CONTROLLER(new LogisticalControllerBlock()),
// LOGISTICAL_CONTROLLER_INDICATOR(new LogisticalControllerIndicatorBlock()),
// LOGISTICAL_INDEX(new LogisticalIndexBlock()),
// PACKAGE_FUNNEL(new PackageFunnelBlock()),
// LOGISTICIANS_TABLE(new LogisticiansTableBlock()),
// LOGISTICIANS_TABLE_INDICATOR(new RenderUtilityBlock()),
__CURIOSITIES__(),
SYMMETRY_PLANE(new PlaneSymmetryBlock()),

View file

@ -7,10 +7,6 @@ import com.simibubi.create.modules.logistics.item.filter.AttributeFilterContaine
import com.simibubi.create.modules.logistics.item.filter.AttributeFilterScreen;
import com.simibubi.create.modules.logistics.item.filter.FilterContainer;
import com.simibubi.create.modules.logistics.item.filter.FilterScreen;
import com.simibubi.create.modules.logistics.management.controller.LogisticalInventoryControllerContainer;
import com.simibubi.create.modules.logistics.management.controller.LogisticalInventoryControllerScreen;
import com.simibubi.create.modules.logistics.management.index.LogisticalIndexContainer;
import com.simibubi.create.modules.logistics.management.index.LogisticalIndexScreen;
import com.simibubi.create.modules.schematics.block.SchematicTableContainer;
import com.simibubi.create.modules.schematics.block.SchematicTableScreen;
import com.simibubi.create.modules.schematics.block.SchematicannonContainer;
@ -34,8 +30,8 @@ public enum AllContainers {
SCHEMATIC_TABLE(SchematicTableContainer::new),
SCHEMATICANNON(SchematicannonContainer::new),
FLEXCRATE(FlexcrateContainer::new),
LOGISTICAL_INDEX(LogisticalIndexContainer::new),
LOGISTICAL_CONTROLLER(LogisticalInventoryControllerContainer::new),
// LOGISTICAL_INDEX(LogisticalIndexContainer::new),
// LOGISTICAL_CONTROLLER(LogisticalInventoryControllerContainer::new),
FILTER(FilterContainer::new),
ATTRIBUTE_FILTER(AttributeFilterContainer::new),
@ -62,8 +58,8 @@ public enum AllContainers {
bind(SCHEMATIC_TABLE, SchematicTableScreen::new);
bind(SCHEMATICANNON, SchematicannonScreen::new);
bind(FLEXCRATE, FlexcrateScreen::new);
bind(LOGISTICAL_INDEX, LogisticalIndexScreen::new);
bind(LOGISTICAL_CONTROLLER, LogisticalInventoryControllerScreen::new);
// bind(LOGISTICAL_INDEX, LogisticalIndexScreen::new);
// bind(LOGISTICAL_CONTROLLER, LogisticalInventoryControllerScreen::new);
bind(FILTER, FilterScreen::new);
bind(ATTRIBUTE_FILTER, AttributeFilterScreen::new);
}

View file

@ -4,8 +4,6 @@ import java.util.function.Function;
import com.simibubi.create.modules.contraptions.components.contraptions.ContraptionEntity;
import com.simibubi.create.modules.contraptions.components.contraptions.ContraptionEntityRenderer;
import com.simibubi.create.modules.logistics.transport.CardboardBoxEntity;
import com.simibubi.create.modules.logistics.transport.CardboardBoxEntityRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityClassification;
@ -20,7 +18,7 @@ import net.minecraftforge.fml.client.registry.RenderingRegistry;
public enum AllEntities {
CARDBOARD_BOX(CardboardBoxEntity::new, 30, 3, CardboardBoxEntity::build),
// CARDBOARD_BOX(CardboardBoxEntity::new, 30, 3, CardboardBoxEntity::build),
CONTRAPTION(ContraptionEntity::new, 30, 3, ContraptionEntity::build),
;
@ -58,7 +56,7 @@ public enum AllEntities {
@OnlyIn(value = Dist.CLIENT)
public static void registerRenderers() {
RenderingRegistry.registerEntityRenderingHandler(CardboardBoxEntity.class, CardboardBoxEntityRenderer::new);
// RenderingRegistry.registerEntityRenderingHandler(CardboardBoxEntity.class, CardboardBoxEntityRenderer::new);
RenderingRegistry.registerEntityRenderingHandler(ContraptionEntity.class, ContraptionEntityRenderer::new);
}

View file

@ -9,18 +9,16 @@ import com.simibubi.create.modules.contraptions.WrenchItemRenderer;
import com.simibubi.create.modules.contraptions.relays.belt.BeltConnectorItem;
import com.simibubi.create.modules.contraptions.relays.gearbox.VerticalGearboxItem;
import com.simibubi.create.modules.curiosities.ChromaticCompoundCubeItem;
import com.simibubi.create.modules.curiosities.blockzapper.BlockzapperItem;
import com.simibubi.create.modules.curiosities.blockzapper.BlockzapperItemRenderer;
import com.simibubi.create.modules.curiosities.deforester.DeforesterItem;
import com.simibubi.create.modules.curiosities.deforester.DeforesterItemRenderer;
import com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunItem;
import com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunItemRenderer;
import com.simibubi.create.modules.curiosities.symmetry.SymmetryWandItem;
import com.simibubi.create.modules.curiosities.symmetry.client.SymmetryWandItemRenderer;
import com.simibubi.create.modules.curiosities.tools.SandPaperItem;
import com.simibubi.create.modules.curiosities.tools.SandPaperItemRenderer;
import com.simibubi.create.modules.gardens.TreeFertilizerItem;
import com.simibubi.create.modules.logistics.item.CardboardBoxItem;
import com.simibubi.create.modules.logistics.item.filter.FilterItem;
import com.simibubi.create.modules.logistics.management.LogisticalDialItem;
import com.simibubi.create.modules.logistics.management.base.LogisticalControllerBlock.Type;
import com.simibubi.create.modules.logistics.management.base.LogisticalControllerItem;
import com.simibubi.create.modules.schematics.item.SchematicAndQuillItem;
import com.simibubi.create.modules.schematics.item.SchematicItem;
@ -42,47 +40,37 @@ import net.minecraftforge.registries.IForgeRegistry;
public enum AllItems {
__MATERIALS__(),
ANDESITE_ALLOY_CUBE(ingredient()),
COPPER_INGOT(ingredient()),
ZINC_CUBE(ingredient()),
BRASS_CUBE(ingredient()),
COPPER_NUGGET(ingredient()),
ZINC_NUGGET(ingredient()),
BRASS_NUGGET(ingredient()),
IRON_SHEET(ingredient()),
GOLD_SHEET(ingredient()),
COPPER_SHEET(ingredient()),
BRASS_SHEET(ingredient()),
BLAZE_BRASS_CUBE(new Item(new Properties())),
CHORUS_CHROME_CUBE(new Item(new Properties().rarity(Rarity.UNCOMMON))),
SHADOW_STEEL_CUBE(new Item(new Properties().rarity(Rarity.UNCOMMON))),
ROSE_QUARTZ(new Item(new Properties())),
REFINED_ROSE_QUARTZ(new Item(new Properties())),
CHROMATIC_COMPOUND_CUBE(new ChromaticCompoundCubeItem(new Properties().rarity(Rarity.UNCOMMON))),
REFINED_RADIANCE_CUBE(new Item(new Properties().rarity(Rarity.UNCOMMON))),
LAPIS_PLATE(ingredient()),
CRUSHED_IRON(ingredient()),
CRUSHED_GOLD(ingredient()),
CRUSHED_COPPER(ingredient()),
CRUSHED_ZINC(ingredient()),
CRUSHED_BRASS(ingredient()),
ELECTRON_TUBE(ingredient()),
CIRCUIT(ingredient()),
// BLAZING_PICKAXE(new BlazingToolItem(1, -2.8F, standardProperties(), PICKAXE)),
// BLAZING_SHOVEL(new BlazingToolItem(1.5F, -3.0F, standardProperties(), SHOVEL)),
// BLAZING_AXE(new BlazingToolItem(5.0F, -3.0F, standardProperties(), AXE)),
// BLAZING_SWORD(new BlazingToolItem(3, -2.4F, standardProperties(), SWORD)),
//
// ROSE_QUARTZ_PICKAXE(new RoseQuartzToolItem(1, -2.8F, standardProperties(), PICKAXE)),
// ROSE_QUARTZ_SHOVEL(new RoseQuartzToolItem(1.5F, -3.0F, standardProperties(), SHOVEL)),
// ROSE_QUARTZ_AXE(new RoseQuartzToolItem(5.0F, -3.0F, standardProperties(), AXE)),
// ROSE_QUARTZ_SWORD(new RoseQuartzToolItem(3, -2.4F, standardProperties(), SWORD)),
//
// SHADOW_STEEL_PICKAXE(new ShadowSteelToolItem(2.5F, -2.0F, standardProperties(), PICKAXE)),
// SHADOW_STEEL_MATTOCK(new ShadowSteelToolItem(2.5F, -1.5F, standardProperties(), SHOVEL, AXE, HOE)),
// SHADOW_STEEL_SWORD(new ShadowSteelToolItem(3, -2.0F, standardProperties(), SWORD)),
ANDESITE_ALLOY(ingredient()),
COPPER_INGOT(ingredient()),
ZINC_INGOT(ingredient()),
BRASS_INGOT(ingredient()),
SAND_PAPER(
new SandPaperItem(standardItemProperties().setTEISR(() -> () -> renderUsing(AllItemRenderers.SAND_PAPER)))),
RED_SAND_PAPER(
new SandPaperItem(standardItemProperties().setTEISR(() -> () -> renderUsing(AllItemRenderers.SAND_PAPER)))),
OBSIDIAN_DUST(ingredient()),
ROSE_QUARTZ(ingredient()),
POLISHED_ROSE_QUARTZ(ingredient()),
CHROMATIC_COMPOUND(new ChromaticCompoundCubeItem(standardItemProperties().rarity(Rarity.UNCOMMON))),
SHADOW_STEEL(new Item(standardItemProperties().rarity(Rarity.UNCOMMON))),
REFINED_RADIANCE(new Item(standardItemProperties().rarity(Rarity.UNCOMMON))),
ELECTRON_TUBE(ingredient()),
INTEGRATED_CIRCUIT(ingredient()),
__GARDENS__(),
TREE_FERTILIZER(new TreeFertilizerItem(standardItemProperties())),
@ -102,24 +90,25 @@ public enum AllItems {
GOGGLES(new GogglesItem(standardItemProperties()), true),
__LOGISTICS__(),
CARDBOARD_BOX_1616(new CardboardBoxItem(standardItemProperties())),
CARDBOARD_BOX_1612(new CardboardBoxItem(standardItemProperties())),
CARDBOARD_BOX_1416(new CardboardBoxItem(standardItemProperties())),
CARDBOARD_BOX_1410(new CardboardBoxItem(standardItemProperties())),
// CARDBOARD_BOX(new CardboardBoxItem(standardItemProperties())),
// CARDBOARD_BOX_1(new CardboardBoxItem(standardItemProperties())),
// CARDBOARD_BOX_2(new CardboardBoxItem(standardItemProperties())),
// CARDBOARD_BOX_3(new CardboardBoxItem(standardItemProperties())),
FILTER(new FilterItem(standardItemProperties()), true),
PROPERTY_FILTER(new FilterItem(standardItemProperties()), true),
LOGISTICAL_FILTER(new FilterItem(standardItemProperties())),
LOGISTICAL_DIAL(new LogisticalDialItem(standardItemProperties())),
LOGISTICAL_CONTROLLER_SUPPLY(new LogisticalControllerItem(standardItemProperties(), Type.SUPPLY)),
LOGISTICAL_CONTROLLER_REQUEST(new LogisticalControllerItem(standardItemProperties(), Type.REQUEST)),
LOGISTICAL_CONTROLLER_STORAGE(new LogisticalControllerItem(standardItemProperties(), Type.STORAGE)),
LOGISTICAL_CONTROLLER_CALCULATION(new LogisticalControllerItem(standardItemProperties(), Type.CALCULATION)),
LOGISTICAL_CONTROLLER_TRANSACTIONS(new LogisticalControllerItem(standardItemProperties(), Type.TRANSACTIONS)),
// LOGISTICAL_FILTER(new FilterItem(standardItemProperties())),
// LOGISTICAL_DIAL(new LogisticalDialItem(standardItemProperties())),
// LOGISTICAL_CONTROLLER_SUPPLY(new LogisticalControllerItem(standardItemProperties(), Type.SUPPLY)),
// LOGISTICAL_CONTROLLER_REQUEST(new LogisticalControllerItem(standardItemProperties(), Type.REQUEST)),
// LOGISTICAL_CONTROLLER_STORAGE(new LogisticalControllerItem(standardItemProperties(), Type.STORAGE)),
// LOGISTICAL_CONTROLLER_CALCULATION(new LogisticalControllerItem(standardItemProperties(), Type.CALCULATION)),
// LOGISTICAL_CONTROLLER_TRANSACTIONS(new LogisticalControllerItem(standardItemProperties(), Type.TRANSACTIONS)),
__CURIOSITIES__(),
PLACEMENT_HANDGUN(
new BuilderGunItem(new Properties().setTEISR(() -> () -> renderUsing(AllItemRenderers.BUILDER_GUN))), true),
new BlockzapperItem(new Properties().setTEISR(() -> () -> renderUsing(AllItemRenderers.BUILDER_GUN))),
true),
DEFORESTER(
new DeforesterItem(standardItemProperties().setTEISR(() -> () -> renderUsing(AllItemRenderers.DEFORESTER))),
true),
@ -197,7 +186,7 @@ public enum AllItems {
// Client
private enum AllItemRenderers {
SYMMETRY_WAND, BUILDER_GUN, WRENCH, DEFORESTER;
SYMMETRY_WAND, BUILDER_GUN, WRENCH, DEFORESTER, SAND_PAPER;
}
@OnlyIn(Dist.CLIENT)
@ -217,11 +206,13 @@ public enum AllItems {
case SYMMETRY_WAND:
return new SymmetryWandItemRenderer();
case BUILDER_GUN:
return new BuilderGunItemRenderer();
return new BlockzapperItemRenderer();
case WRENCH:
return new WrenchItemRenderer();
case DEFORESTER:
return new DeforesterItemRenderer();
case SAND_PAPER:
return new SandPaperItemRenderer();
default:
return null;
}

View file

@ -10,13 +10,10 @@ import com.simibubi.create.foundation.packet.SimplePacketBase;
import com.simibubi.create.modules.contraptions.components.contraptions.chassis.ConfigureChassisPacket;
import com.simibubi.create.modules.contraptions.components.mixer.ConfigureMixerPacket;
import com.simibubi.create.modules.contraptions.components.motor.ConfigureMotorPacket;
import com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunBeamPacket;
import com.simibubi.create.modules.curiosities.blockzapper.BlockzapperBeamPacket;
import com.simibubi.create.modules.curiosities.symmetry.SymmetryEffectPacket;
import com.simibubi.create.modules.logistics.block.diodes.ConfigureFlexpeaterPacket;
import com.simibubi.create.modules.logistics.item.filter.FilterScreenPacket;
import com.simibubi.create.modules.logistics.management.controller.LogisticalControllerConfigurationPacket;
import com.simibubi.create.modules.logistics.management.index.IndexContainerUpdatePacket;
import com.simibubi.create.modules.logistics.management.index.IndexOrderRequest;
import com.simibubi.create.modules.logistics.packet.ConfigureFlexcratePacket;
import com.simibubi.create.modules.logistics.packet.ConfigureStockswitchPacket;
import com.simibubi.create.modules.schematics.packet.ConfigureSchematicannonPacket;
@ -39,19 +36,19 @@ public enum AllPackets {
CONFIGURE_CHASSIS(ConfigureChassisPacket.class, ConfigureChassisPacket::new),
CONFIGURE_MOTOR(ConfigureMotorPacket.class, ConfigureMotorPacket::new),
CONFIGURE_FLEXPEATER(ConfigureFlexpeaterPacket.class, ConfigureFlexpeaterPacket::new),
CONFIGURE_LOGISTICAL_CONTROLLER(LogisticalControllerConfigurationPacket.class,
LogisticalControllerConfigurationPacket::new),
// CONFIGURE_LOGISTICAL_CONTROLLER(LogisticalControllerConfigurationPacket.class,
// LogisticalControllerConfigurationPacket::new),
CONFIGURE_MIXER(ConfigureMixerPacket.class, ConfigureMixerPacket::new),
PLACE_SCHEMATIC(SchematicPlacePacket.class, SchematicPlacePacket::new),
UPLOAD_SCHEMATIC(SchematicUploadPacket.class, SchematicUploadPacket::new),
INDEX_ORDER_REQUEST(IndexOrderRequest.class, IndexOrderRequest::new),
// INDEX_ORDER_REQUEST(IndexOrderRequest.class, IndexOrderRequest::new),
CONFIGURE_FILTER(FilterScreenPacket.class, FilterScreenPacket::new),
CONFIGURE_FILTERING_AMOUNT(FilteringCountUpdatePacket.class, FilteringCountUpdatePacket::new),
// Server to Client
SYMMETRY_EFFECT(SymmetryEffectPacket.class, SymmetryEffectPacket::new),
BEAM_EFFECT(BuilderGunBeamPacket.class, BuilderGunBeamPacket::new),
INDEX_CONTAINER_UPDATE(IndexContainerUpdatePacket.class, IndexContainerUpdatePacket::new),
BEAM_EFFECT(BlockzapperBeamPacket.class, BlockzapperBeamPacket::new),
// INDEX_CONTAINER_UPDATE(IndexContainerUpdatePacket.class, IndexContainerUpdatePacket::new),
;

View file

@ -12,7 +12,8 @@ import com.simibubi.create.modules.contraptions.components.saw.CuttingRecipe;
import com.simibubi.create.modules.contraptions.processing.ProcessingRecipe;
import com.simibubi.create.modules.contraptions.processing.ProcessingRecipeSerializer;
import com.simibubi.create.modules.contraptions.processing.ProcessingRecipeSerializer.IRecipeFactory;
import com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunUpgradeRecipe;
import com.simibubi.create.modules.curiosities.blockzapper.BlockzapperUpgradeRecipe;
import com.simibubi.create.modules.curiosities.tools.SandPaperPolishingRecipe;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.crafting.IRecipe;
@ -25,13 +26,14 @@ import net.minecraftforge.event.RegistryEvent;
public enum AllRecipes {
BLOCKZAPPER_UPGRADE(BuilderGunUpgradeRecipe.Serializer::new, IRecipeType.CRAFTING),
BLOCKZAPPER_UPGRADE(BlockzapperUpgradeRecipe.Serializer::new, IRecipeType.CRAFTING),
MECHANICAL_CRAFTING(MechanicalCraftingRecipe.Serializer::new),
CRUSHING(processingSerializer(CrushingRecipe::new)),
SPLASHING(processingSerializer(SplashingRecipe::new)),
PRESSING(processingSerializer(PressingRecipe::new)),
CUTTING(processingSerializer(CuttingRecipe::new)),
MIXING(processingSerializer(MixingRecipe::new)),
SANDPAPER_POLISHING(processingSerializer(SandPaperPolishingRecipe::new)),
;

View file

@ -63,18 +63,6 @@ import com.simibubi.create.modules.logistics.block.extractor.LinkedExtractorTile
import com.simibubi.create.modules.logistics.block.inventories.FlexcrateTileEntity;
import com.simibubi.create.modules.logistics.block.transposer.LinkedTransposerTileEntity;
import com.simibubi.create.modules.logistics.block.transposer.TransposerTileEntity;
import com.simibubi.create.modules.logistics.management.base.LogisticalCasingTileEntity;
import com.simibubi.create.modules.logistics.management.base.LogisticalControllerTileEntity;
import com.simibubi.create.modules.logistics.management.base.LogisticalControllerTileEntityRenderer;
import com.simibubi.create.modules.logistics.management.controller.CalculationTileEntity;
import com.simibubi.create.modules.logistics.management.controller.RequestTileEntity;
import com.simibubi.create.modules.logistics.management.controller.StorageTileEntity;
import com.simibubi.create.modules.logistics.management.controller.SupplyTileEntity;
import com.simibubi.create.modules.logistics.management.controller.TransactionsTileEntity;
import com.simibubi.create.modules.logistics.management.index.LogisticalIndexTileEntity;
import com.simibubi.create.modules.logistics.transport.villager.LogisticiansTableTileEntity;
import com.simibubi.create.modules.logistics.transport.villager.LogisticiansTableTileEntityRenderer;
import com.simibubi.create.modules.logistics.transport.villager.PackageFunnelTileEntity;
import com.simibubi.create.modules.schematics.block.SchematicTableTileEntity;
import com.simibubi.create.modules.schematics.block.SchematicannonRenderer;
import com.simibubi.create.modules.schematics.block.SchematicannonTileEntity;
@ -141,15 +129,15 @@ public enum AllTileEntities {
BELT_FUNNEL(FunnelTileEntity::new, AllBlocks.BELT_FUNNEL, AllBlocks.VERTICAL_FUNNEL),
ENTITY_DETECTOR(BeltObserverTileEntity::new, AllBlocks.ENTITY_DETECTOR),
FLEXPEATER(FlexpeaterTileEntity::new, AllBlocks.FLEXPEATER),
LOGISTICAL_CASING(LogisticalCasingTileEntity::new, AllBlocks.LOGISTICAL_CASING),
LOGISTICAL_SUPPLY_CONTROLLER(SupplyTileEntity::new, AllBlocks.LOGISTICAL_CONTROLLER),
LOGISTICAL_REQUEST_CONTROLLER(RequestTileEntity::new, AllBlocks.LOGISTICAL_CONTROLLER),
LOGISTICAL_STORAGE_CONTROLLER(StorageTileEntity::new, AllBlocks.LOGISTICAL_CONTROLLER),
LOGISTICAL_CALCULATION_CONTROLLER(CalculationTileEntity::new, AllBlocks.LOGISTICAL_CONTROLLER),
LOGISTICAL_TRANSATIONS_CONTROLLER(TransactionsTileEntity::new, AllBlocks.LOGISTICAL_CONTROLLER),
LOGISTICAL_INDEX(LogisticalIndexTileEntity::new, AllBlocks.LOGISTICAL_INDEX),
LOGISTICIANS_TABLE(LogisticiansTableTileEntity::new, AllBlocks.LOGISTICIANS_TABLE),
PACKAGE_FUNNEL(PackageFunnelTileEntity::new, AllBlocks.PACKAGE_FUNNEL),
// LOGISTICAL_CASING(LogisticalCasingTileEntity::new, AllBlocks.LOGISTICAL_CASING),
// LOGISTICAL_SUPPLY_CONTROLLER(SupplyTileEntity::new, AllBlocks.LOGISTICAL_CONTROLLER),
// LOGISTICAL_REQUEST_CONTROLLER(RequestTileEntity::new, AllBlocks.LOGISTICAL_CONTROLLER),
// LOGISTICAL_STORAGE_CONTROLLER(StorageTileEntity::new, AllBlocks.LOGISTICAL_CONTROLLER),
// LOGISTICAL_CALCULATION_CONTROLLER(CalculationTileEntity::new, AllBlocks.LOGISTICAL_CONTROLLER),
// LOGISTICAL_TRANSATIONS_CONTROLLER(TransactionsTileEntity::new, AllBlocks.LOGISTICAL_CONTROLLER),
// LOGISTICAL_INDEX(LogisticalIndexTileEntity::new, AllBlocks.LOGISTICAL_INDEX),
// LOGISTICIANS_TABLE(LogisticiansTableTileEntity::new, AllBlocks.LOGISTICIANS_TABLE),
// PACKAGE_FUNNEL(PackageFunnelTileEntity::new, AllBlocks.PACKAGE_FUNNEL),
// Curiosities
WINDOW_IN_A_BLOCK(WindowInABlockTileEntity::new, AllBlocks.WINDOW_IN_A_BLOCK),
@ -218,12 +206,12 @@ public enum AllTileEntities {
bind(TransposerTileEntity.class, new SmartTileEntityRenderer<>());
bind(LinkedTransposerTileEntity.class, new SmartTileEntityRenderer<>());
bind(FunnelTileEntity.class, new SmartTileEntityRenderer<>());
bind(BeltTunnelTileEntity.class, new BeltTunnelTileEntityRenderer());
bind(BeltObserverTileEntity.class, new BeltObserverTileEntityRenderer());
bind(FlexpeaterTileEntity.class, new FlexpeaterTileEntityRenderer());
bind(LogisticalControllerTileEntity.class, new LogisticalControllerTileEntityRenderer());
bind(LogisticiansTableTileEntity.class, new LogisticiansTableTileEntityRenderer());
// bind(LogisticalControllerTileEntity.class, new LogisticalControllerTileEntityRenderer());
// bind(LogisticiansTableTileEntity.class, new LogisticiansTableTileEntityRenderer());
}
@OnlyIn(Dist.CLIENT)

View file

@ -1,18 +1,14 @@
package com.simibubi.create;
import com.simibubi.create.foundation.command.CreateCommand;
import com.simibubi.create.foundation.command.ServerLagger;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.simibubi.create.foundation.command.CreateCommand;
import com.simibubi.create.foundation.command.ServerLagger;
import com.simibubi.create.foundation.world.OreGeneration;
import com.simibubi.create.modules.ModuleLoadedCondition;
import com.simibubi.create.modules.contraptions.TorquePropagator;
import com.simibubi.create.modules.logistics.RedstoneLinkNetworkHandler;
import com.simibubi.create.modules.logistics.management.LogisticalNetworkHandler;
import com.simibubi.create.modules.logistics.transport.villager.LogisticianHandler;
import com.simibubi.create.modules.schematics.ServerSchematicLoader;
import net.minecraft.block.Block;
@ -25,6 +21,7 @@ import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.particles.ParticleType;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.village.PointOfInterestType;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.crafting.CraftingHelper;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.IEventBus;
@ -32,6 +29,7 @@ import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.config.ModConfig;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
@Mod(Create.ID)
@ -45,10 +43,10 @@ public class Create {
public static ItemGroup creativeTab = new CreateItemGroup();
public static ServerSchematicLoader schematicReceiver;
public static RedstoneLinkNetworkHandler redstoneLinkNetworkHandler;
public static LogisticalNetworkHandler logisticalNetworkHandler;
public static TorquePropagator torquePropagator;
public static LogisticianHandler logisticianHandler;
public static ServerLagger lagger;
// public static LogisticalNetworkHandler logisticalNetworkHandler;
// public static LogisticianHandler logisticianHandler;
public static ModConfig config;
@ -79,7 +77,7 @@ public class Create {
public static void init(final FMLCommonSetupEvent event) {
schematicReceiver = new ServerSchematicLoader();
redstoneLinkNetworkHandler = new RedstoneLinkNetworkHandler();
logisticalNetworkHandler = new LogisticalNetworkHandler();
// logisticalNetworkHandler = new LogisticalNetworkHandler();
torquePropagator = new TorquePropagator();
lagger = new ServerLagger();
@ -92,11 +90,11 @@ public class Create {
}
public static void registerVillagerProfessions(RegistryEvent.Register<VillagerProfession> event) {
LogisticianHandler.registerVillagerProfessions(event);
// LogisticianHandler.registerVillagerProfessions(event);
}
public static void registerPointsOfInterest(RegistryEvent.Register<PointOfInterestType> event) {
LogisticianHandler.registerPointsOfInterest(event);
// LogisticianHandler.registerPointsOfInterest(event);
}
public static void createConfigs(ModConfig.ModConfigEvent event) {

View file

@ -14,10 +14,11 @@ import com.simibubi.create.foundation.utility.SuperByteBufferCache;
import com.simibubi.create.modules.contraptions.WrenchModel;
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
import com.simibubi.create.modules.contraptions.components.contraptions.ContraptionRenderer;
import com.simibubi.create.modules.curiosities.blockzapper.BlockzapperModel;
import com.simibubi.create.modules.curiosities.deforester.DeforesterModel;
import com.simibubi.create.modules.curiosities.partialWindows.WindowInABlockModel;
import com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunModel;
import com.simibubi.create.modules.curiosities.symmetry.client.SymmetryWandModel;
import com.simibubi.create.modules.curiosities.tools.SandPaperItemRenderer.SandPaperModel;
import com.simibubi.create.modules.schematics.ClientSchematicLoader;
import com.simibubi.create.modules.schematics.client.SchematicAndQuillHandler;
import com.simibubi.create.modules.schematics.client.SchematicHandler;
@ -134,10 +135,15 @@ public class CreateClient {
}
swapModels(modelRegistry, getItemModelLocation(AllItems.SAND_PAPER),
t -> new SandPaperModel(t));
swapModels(modelRegistry, getItemModelLocation(AllItems.RED_SAND_PAPER),
t -> new SandPaperModel(t));
swapModels(modelRegistry, getItemModelLocation(AllItems.SYMMETRY_WAND),
t -> new SymmetryWandModel(t).loadPartials(event));
swapModels(modelRegistry, getItemModelLocation(AllItems.PLACEMENT_HANDGUN),
t -> new BuilderGunModel(t).loadPartials(event));
t -> new BlockzapperModel(t).loadPartials(event));
swapModels(modelRegistry, getItemModelLocation(AllItems.WRENCH), t -> new WrenchModel(t).loadPartials(event));
swapModels(modelRegistry, getItemModelLocation(AllItems.DEFORESTER),
t -> new DeforesterModel(t).loadPartials(event));
@ -157,7 +163,7 @@ public class CreateClient {
public static void onModelRegistry(ModelRegistryEvent event) {
for (String location : SymmetryWandModel.getCustomModelLocations())
ModelLoader.addSpecialModel(new ResourceLocation(Create.ID, "item/" + location));
for (String location : BuilderGunModel.getCustomModelLocations())
for (String location : BlockzapperModel.getCustomModelLocations())
ModelLoader.addSpecialModel(new ResourceLocation(Create.ID, "item/" + location));
for (String location : WrenchModel.getCustomModelLocations())
ModelLoader.addSpecialModel(new ResourceLocation(Create.ID, "item/" + location));

View file

@ -44,16 +44,16 @@ public class Events {
public static void onLoadWorld(WorldEvent.Load event) {
IWorld world = event.getWorld();
Create.redstoneLinkNetworkHandler.onLoadWorld(world);
Create.logisticalNetworkHandler.onLoadWorld(world);
Create.torquePropagator.onLoadWorld(world);
// Create.logisticalNetworkHandler.onLoadWorld(world);
}
@SubscribeEvent
public static void onUnloadWorld(WorldEvent.Unload event) {
IWorld world = event.getWorld();
Create.redstoneLinkNetworkHandler.onUnloadWorld(world);
Create.logisticalNetworkHandler.onUnloadWorld(world);
Create.torquePropagator.onUnloadWorld(world);
// Create.logisticalNetworkHandler.onUnloadWorld(world);
}
@SubscribeEvent

View file

@ -68,6 +68,7 @@ public enum ScreenResources {
// JEI
JEI_SLOT("jei/widgets.png", 18, 18),
JEI_CATALYST_SLOT("jei/widgets.png", 0, 136, 18, 18),
JEI_ARROW("jei/widgets.png", 19, 10, 42, 10),
JEI_LONG_ARROW("jei/widgets.png", 19, 0, 71, 10),
JEI_DOWN_ARROW("jei/widgets.png", 0, 21, 18, 14),

View file

@ -12,7 +12,7 @@ import com.simibubi.create.AllItems;
import com.simibubi.create.Create;
import com.simibubi.create.foundation.gui.ScreenElementRenderer;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunUpgradeRecipe;
import com.simibubi.create.modules.curiosities.blockzapper.BlockzapperUpgradeRecipe;
import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.gui.IRecipeLayout;
@ -30,7 +30,7 @@ import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
public class BlockzapperUpgradeCategory implements IRecipeCategory<BuilderGunUpgradeRecipe> {
public class BlockzapperUpgradeCategory implements IRecipeCategory<BlockzapperUpgradeRecipe> {
private static ResourceLocation ID = new ResourceLocation(Create.ID, "blockzapper_upgrade");
private IDrawable icon;
@ -51,8 +51,8 @@ public class BlockzapperUpgradeCategory implements IRecipeCategory<BuilderGunUpg
}
@Override
public Class<? extends BuilderGunUpgradeRecipe> getRecipeClass() {
return BuilderGunUpgradeRecipe.class;
public Class<? extends BlockzapperUpgradeRecipe> getRecipeClass() {
return BlockzapperUpgradeRecipe.class;
}
@Override
@ -66,13 +66,13 @@ public class BlockzapperUpgradeCategory implements IRecipeCategory<BuilderGunUpg
}
@Override
public void setIngredients(BuilderGunUpgradeRecipe recipe, IIngredients ingredients) {
public void setIngredients(BlockzapperUpgradeRecipe recipe, IIngredients ingredients) {
ingredients.setInputIngredients(recipe.getIngredients());
ingredients.setOutput(VanillaTypes.ITEM, recipe.getRecipeOutput());
}
@Override
public void setRecipe(IRecipeLayout recipeLayout, BuilderGunUpgradeRecipe recipe, IIngredients ingredients) {
public void setRecipe(IRecipeLayout recipeLayout, BlockzapperUpgradeRecipe recipe, IIngredients ingredients) {
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
ShapedRecipe shape = recipe.getRecipe();
NonNullList<Ingredient> shapedIngredients = shape.getIngredients();
@ -93,7 +93,7 @@ public class BlockzapperUpgradeCategory implements IRecipeCategory<BuilderGunUpg
}
@Override
public List<String> getTooltipStrings(BuilderGunUpgradeRecipe recipe, double mouseX, double mouseY) {
public List<String> getTooltipStrings(BlockzapperUpgradeRecipe recipe, double mouseX, double mouseY) {
List<String> list = new ArrayList<>();
if (mouseX < 91 || mouseX > 91 + 52 || mouseY < 1 || mouseY > 53)
return list;
@ -106,7 +106,7 @@ public class BlockzapperUpgradeCategory implements IRecipeCategory<BuilderGunUpg
}
@Override
public void draw(BuilderGunUpgradeRecipe recipe, double mouseX, double mouseY) {
public void draw(BlockzapperUpgradeRecipe recipe, double mouseX, double mouseY) {
FontRenderer font = Minecraft.getInstance().fontRenderer;
String componentName = Lang
.translate("blockzapper.component." + Lang.asId(recipe.getUpgradedComponent().name()));

View file

@ -1,6 +1,7 @@
package com.simibubi.create.compat.jei;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.google.common.base.Predicate;
@ -12,7 +13,7 @@ import com.simibubi.create.compat.jei.BlockCuttingCategory.CondensedBlockCutting
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.modules.contraptions.components.mixer.MixingRecipe;
import com.simibubi.create.modules.contraptions.components.press.MechanicalPressTileEntity;
import com.simibubi.create.modules.contraptions.processing.StochasticOutput;
import com.simibubi.create.modules.contraptions.processing.ProcessingOutput;
import com.simibubi.create.modules.logistics.block.inventories.FlexcrateScreen;
import com.simibubi.create.modules.schematics.block.SchematicannonScreen;
@ -171,15 +172,28 @@ public class CreateJEI implements IModPlugin {
return byType;
}
static void addStochasticTooltip(IGuiItemStackGroup itemStacks, List<StochasticOutput> results) {
static void addStochasticTooltip(IGuiItemStackGroup itemStacks, List<ProcessingOutput> results) {
itemStacks.addTooltipCallback((slotIndex, input, ingredient, tooltip) -> {
if (input)
return;
StochasticOutput output = results.get(slotIndex - 1);
ProcessingOutput output = results.get(slotIndex - 1);
if (output.getChance() != 1)
tooltip.add(1, TextFormatting.GOLD
+ Lang.translate("recipe.processing.chance", (int) (output.getChance() * 100)));
});
}
static void addCatalystTooltip(IGuiItemStackGroup itemStacks, Map<Integer, Float> catalystIndices) {
itemStacks.addTooltipCallback((slotIndex, input, ingredient, tooltip) -> {
if (!input)
return;
if (!catalystIndices.containsKey(slotIndex))
return;
Float chance = catalystIndices.get(slotIndex);
tooltip.add(1, TextFormatting.YELLOW + Lang.translate("recipe.processing.catalyst"));
tooltip.add(2, TextFormatting.GOLD
+ Lang.translate("recipe.processing.chanceToReturn", (int) (chance.floatValue() * 100)));
});
}
}

View file

@ -9,7 +9,7 @@ import com.simibubi.create.Create;
import com.simibubi.create.ScreenResources;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.modules.contraptions.components.crusher.CrushingRecipe;
import com.simibubi.create.modules.contraptions.processing.StochasticOutput;
import com.simibubi.create.modules.contraptions.processing.ProcessingOutput;
import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.gui.IRecipeLayout;
@ -69,7 +69,7 @@ public class CrushingCategory implements IRecipeCategory<CrushingRecipe> {
itemStacks.init(0, true, 50, 2);
itemStacks.set(0, Arrays.asList(recipe.getIngredients().get(0).getMatchingStacks()));
List<StochasticOutput> results = recipe.getRollableResults();
List<ProcessingOutput> results = recipe.getRollableResults();
int size = results.size();
int offset = -size * 19 / 2;
for (int outputIndex = 0; outputIndex < size; outputIndex++) {
@ -82,7 +82,7 @@ public class CrushingCategory implements IRecipeCategory<CrushingRecipe> {
@Override
public void draw(CrushingRecipe recipe, double mouseX, double mouseY) {
List<StochasticOutput> results = recipe.getRollableResults();
List<ProcessingOutput> results = recipe.getRollableResults();
ScreenResources.JEI_SLOT.draw(50, 2);
ScreenResources.JEI_DOWN_ARROW.draw(72, 7);

View file

@ -1,7 +1,9 @@
package com.simibubi.create.compat.jei;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.commons.lang3.mutable.MutableInt;
@ -13,6 +15,7 @@ import com.simibubi.create.ScreenResources;
import com.simibubi.create.foundation.item.ItemHelper;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.modules.contraptions.components.mixer.MixingRecipe;
import com.simibubi.create.modules.contraptions.processing.ProcessingIngredient;
import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.gui.IRecipeLayout;
@ -70,6 +73,17 @@ public class MixingCategory implements IRecipeCategory<MixingRecipe> {
NonNullList<Ingredient> recipeIngredients = recipe.getIngredients();
List<Pair<Ingredient, MutableInt>> actualIngredients = ItemHelper.condenseIngredients(recipeIngredients);
Map<Integer, Float> catalystIndices = new HashMap<>(9);
for (int i = 0; i < actualIngredients.size(); i++) {
for (ProcessingIngredient processingIngredient : recipe.getRollableIngredients()) {
if (processingIngredient.isCatalyst() && ItemHelper
.matchIngredients(processingIngredient.getIngredient(), actualIngredients.get(i).getKey())) {
catalystIndices.put(i, processingIngredient.getOutputChance());
break;
}
}
}
int size = actualIngredients.size();
int xOffset = size < 3 ? (3 - size) * 19 / 2 : 0;
@ -88,16 +102,29 @@ public class MixingCategory implements IRecipeCategory<MixingRecipe> {
itemStacks.init(i, false, 141, 50);
itemStacks.set(i, recipe.getRecipeOutput().getStack());
CreateJEI.addCatalystTooltip(itemStacks, catalystIndices);
}
@Override
public void draw(MixingRecipe recipe, double mouseX, double mouseY) {
// this might actually be pretty bad with big ingredients. ^ its a draw method
List<Pair<Ingredient, MutableInt>> actualIngredients = ItemHelper.condenseIngredients(recipe.getIngredients());
int size = actualIngredients.size();
int xOffset = size < 3 ? (3 - size) * 19 / 2 : 0;
for (int i = 0; i < size; i++)
ScreenResources.JEI_SLOT.draw(16 + xOffset + (i % 3) * 19, 50 - (i / 3) * 19);
for (int i = 0; i < size; i++) {
ScreenResources jeiSlot = ScreenResources.JEI_SLOT;
for (ProcessingIngredient processingIngredient : recipe.getRollableIngredients()) {
if (processingIngredient.isCatalyst() && ItemHelper
.matchIngredients(processingIngredient.getIngredient(), actualIngredients.get(i).getKey())) {
jeiSlot = ScreenResources.JEI_CATALYST_SLOT;
break;
}
}
jeiSlot.draw(16 + xOffset + (i % 3) * 19, 50 - (i / 3) * 19);
}
ScreenResources.JEI_SLOT.draw(141, 50);
ScreenResources.JEI_DOWN_ARROW.draw(136, 32);
ScreenResources.JEI_SHADOW.draw(81, 57);

View file

@ -9,7 +9,7 @@ import com.simibubi.create.Create;
import com.simibubi.create.ScreenResources;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.modules.contraptions.components.press.PressingRecipe;
import com.simibubi.create.modules.contraptions.processing.StochasticOutput;
import com.simibubi.create.modules.contraptions.processing.ProcessingOutput;
import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.gui.IRecipeLayout;
@ -70,7 +70,7 @@ public class PressingCategory implements IRecipeCategory<PressingRecipe> {
itemStacks.init(0, true, 26, 50);
itemStacks.set(0, Arrays.asList(recipe.getIngredients().get(0).getMatchingStacks()));
List<StochasticOutput> results = recipe.getRollableResults();
List<ProcessingOutput> results = recipe.getRollableResults();
for (int outputIndex = 0; outputIndex < results.size(); outputIndex++) {
itemStacks.init(outputIndex + 1, false, 131 + 19 * outputIndex, 50);
itemStacks.set(outputIndex + 1, results.get(outputIndex).getStack());

View file

@ -8,7 +8,7 @@ import com.simibubi.create.Create;
import com.simibubi.create.ScreenResources;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.modules.contraptions.components.saw.CuttingRecipe;
import com.simibubi.create.modules.contraptions.processing.StochasticOutput;
import com.simibubi.create.modules.contraptions.processing.ProcessingOutput;
import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.gui.IRecipeLayout;
@ -69,7 +69,7 @@ public class SawingCategory implements IRecipeCategory<CuttingRecipe> {
itemStacks.init(0, true, 43, 4);
itemStacks.set(0, Arrays.asList(recipe.getIngredients().get(0).getMatchingStacks()));
List<StochasticOutput> results = recipe.getRollableResults();
List<ProcessingOutput> results = recipe.getRollableResults();
for (int outputIndex = 0; outputIndex < results.size(); outputIndex++) {
int xOffset = outputIndex % 2 == 0 ? 0 : 19;
int yOffset = (outputIndex / 2) * -19;

View file

@ -10,7 +10,7 @@ import com.simibubi.create.ScreenResources;
import com.simibubi.create.foundation.gui.ScreenElementRenderer;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.modules.contraptions.components.fan.SplashingRecipe;
import com.simibubi.create.modules.contraptions.processing.StochasticOutput;
import com.simibubi.create.modules.contraptions.processing.ProcessingOutput;
import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.gui.IRecipeLayout;
@ -72,7 +72,7 @@ public class SplashingCategory extends ProcessingViaFanCategory<SplashingRecipe>
itemStacks.init(0, true, 20, 47);
itemStacks.set(0, Arrays.asList(recipe.getIngredients().get(0).getMatchingStacks()));
List<StochasticOutput> results = recipe.getRollableResults();
List<ProcessingOutput> results = recipe.getRollableResults();
boolean single = results.size() == 1;
for (int outputIndex = 0; outputIndex < results.size(); outputIndex++) {
int xOffset = outputIndex % 2 == 0 ? 0 : 19;

View file

@ -1,6 +1,7 @@
package com.simibubi.create.foundation.command;
import com.mojang.brigadier.CommandDispatcher;
import net.minecraft.command.CommandSource;
public class CreateCommand {

View file

@ -4,6 +4,7 @@ import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.IntegerArgumentType;
import com.simibubi.create.Create;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.command.CommandSource;
import net.minecraft.command.Commands;

View file

@ -1,5 +1,7 @@
package com.simibubi.create.foundation.utility;
import java.util.UUID;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.util.math.Vec3d;
@ -60,5 +62,12 @@ public class ColorHelper {
int b = color & 0xFF;
return new Vec3d(r, g, b).scale(1 / 256d);
}
public static int colorFromUUID(UUID uuid) {
if (uuid == null)
return 0x333333;
int rainbowColor = ColorHelper.rainbowColor((int) uuid.getLeastSignificantBits());
return ColorHelper.mixColors(rainbowColor, 0xFFFFFF, .5f);
}
}

View file

@ -1,10 +1,10 @@
package com.simibubi.create.modules.contraptions;
import com.simibubi.create.foundation.block.connected.CTSpriteShifter;
import com.simibubi.create.foundation.block.connected.CTSpriteShifter.CTType;
import com.simibubi.create.foundation.block.connected.ConnectedTextureBehaviour;
import com.simibubi.create.foundation.block.connected.IHaveConnectedTextures;
import com.simibubi.create.foundation.block.connected.StandardCTBehaviour;
import com.simibubi.create.foundation.block.connected.CTSpriteShifter.CTType;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;

View file

@ -3,10 +3,10 @@ package com.simibubi.create.modules.contraptions.base;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.CreateClient;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.ColorHelper;
import com.simibubi.create.foundation.utility.SuperByteBuffer;
import com.simibubi.create.foundation.utility.SuperByteBufferCache.Compartment;
import com.simibubi.create.modules.contraptions.KineticDebugger;
import com.simibubi.create.modules.logistics.management.base.LogisticalActorTileEntity;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.BufferBuilder;
@ -58,7 +58,7 @@ public class KineticTileEntityRenderer extends TileEntityRendererFast<KineticTil
if (KineticDebugger.isActive()) {
rainbowMode = true;
if (te.hasNetwork())
buffer.color(LogisticalActorTileEntity.colorFromUUID(te.getNetworkID()));
buffer.color(ColorHelper.colorFromUUID(te.getNetworkID()));
else
buffer.color(0xFFFFFF);
}

View file

@ -3,18 +3,18 @@ package com.simibubi.create.modules.contraptions.components.crusher;
import java.util.List;
import com.simibubi.create.AllRecipes;
import com.simibubi.create.modules.contraptions.processing.ProcessingIngredient;
import com.simibubi.create.modules.contraptions.processing.ProcessingInventory;
import com.simibubi.create.modules.contraptions.processing.ProcessingOutput;
import com.simibubi.create.modules.contraptions.processing.ProcessingRecipe;
import com.simibubi.create.modules.contraptions.processing.StochasticOutput;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
public class CrushingRecipe extends ProcessingRecipe<ProcessingInventory> {
public CrushingRecipe(ResourceLocation id, String group, List<Ingredient> ingredients,
List<StochasticOutput> results, int processingDuration) {
public CrushingRecipe(ResourceLocation id, String group, List<ProcessingIngredient> ingredients,
List<ProcessingOutput> results, int processingDuration) {
super(AllRecipes.CRUSHING, id, group, ingredients, results, processingDuration);
}
@ -24,5 +24,10 @@ public class CrushingRecipe extends ProcessingRecipe<ProcessingInventory> {
return false;
return ingredients.get(0).test(inv.getStackInSlot(0));
}
@Override
protected int getMaxOutputCount() {
return 7;
}
}

View file

@ -15,8 +15,8 @@ import net.minecraft.item.ItemUseContext;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.Vec3d;
@ -55,7 +55,7 @@ public class DeployerBlock extends DirectionalAxisKineticBlock implements IWithT
}
return super.onWrenched(state, context);
}
@Override
public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) {
if (state.hasTileEntity() && state.getBlock() != newState.getBlock()) {
@ -63,31 +63,34 @@ public class DeployerBlock extends DirectionalAxisKineticBlock implements IWithT
te.player.inventory.dropAllItems();
te.overflowItems.forEach(itemstack -> te.player.dropItem(itemstack, true, false));
});
worldIn.removeTileEntity(pos);
}
worldIn.removeTileEntity(pos);
}
}
@Override
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn,
BlockRayTraceResult hit) {
ItemStack held = player.getHeldItem(handIn);
if (AllItems.WRENCH.typeOf(held))
ItemStack heldByPlayer = player.getHeldItem(handIn).copy();
if (AllItems.WRENCH.typeOf(heldByPlayer))
return false;
if (hit.getFace() == state.get(FACING)) {
if (!worldIn.isRemote)
withTileEntityDo(worldIn, pos, te -> {
ItemStack heldItemMainhand = te.player.getHeldItemMainhand();
if (heldItemMainhand.isEmpty())
return;
player.inventory.placeItemBackInInventory(worldIn, heldItemMainhand);
te.player.setHeldItem(Hand.MAIN_HAND, ItemStack.EMPTY);
te.sendData();
});
if (hit.getFace() != state.get(FACING))
return false;
if (worldIn.isRemote)
return true;
}
return false;
withTileEntityDo(worldIn, pos, te -> {
ItemStack heldByDeployer = te.player.getHeldItemMainhand().copy();
if (heldByDeployer.isEmpty() && heldByPlayer.isEmpty())
return;
player.setHeldItem(handIn, heldByDeployer);
te.player.setHeldItem(Hand.MAIN_HAND, heldByPlayer);
te.sendData();
});
return true;
}
public static Vec3d getFilterSlotPosition(BlockState state) {

View file

@ -24,6 +24,7 @@ import com.simibubi.create.foundation.utility.NBTHelper;
import com.simibubi.create.foundation.utility.VecHelper;
import com.simibubi.create.foundation.utility.WrappedWorld;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
import com.simibubi.create.modules.curiosities.tools.SandPaperItem;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
@ -86,6 +87,7 @@ public class DeployerTileEntity extends KineticTileEntity {
protected Pair<BlockPos, Float> blockBreakingProgress;
private ListNBT deferredInventoryList;
private ItemStack spawnItemEffects;
enum State {
WAITING, EXPANDING, RETRACTING, DUMPING;
@ -223,6 +225,7 @@ public class DeployerTileEntity extends KineticTileEntity {
player.getAttributes().applyAttributeModifiers(attributeModifiers);
activate();
player.getAttributes().removeAttributeModifiers(attributeModifiers);
heldItem = player.getHeldItemMainhand();
state = State.RETRACTING;
timer = 1000;
@ -339,12 +342,11 @@ public class DeployerTileEntity extends KineticTileEntity {
ItemUseContext itemusecontext = new ItemUseContext(player, hand, result);
RightClickBlock event = ForgeHooks.onRightClickBlock(player, hand, clickedPos, direction.getOpposite());
// Item has active use (food for instance)
// Item has custom active use
if (event.getUseItem() != DENY) {
ActionResultType actionresult = stack.onItemUseFirst(itemusecontext);
if (actionresult != ActionResultType.PASS)
return;
player.setHeldItem(hand, stack.onItemUseFinish(world, player));
}
boolean holdingSomething = !player.getHeldItemMainhand().isEmpty();
@ -385,7 +387,7 @@ public class DeployerTileEntity extends KineticTileEntity {
return;
// buckets create their own ray, We use a fake wall to contain the active area
if (item instanceof BucketItem) {
if (item instanceof BucketItem || item instanceof SandPaperItem) {
world = new WrappedWorld(world) {
@Override
@ -415,6 +417,17 @@ public class DeployerTileEntity extends KineticTileEntity {
ActionResult<ItemStack> onItemRightClick = item.onItemRightClick(world, player, hand);
player.setHeldItem(hand, onItemRightClick.getResult());
CompoundNBT tag = stack.getOrCreateTag();
if (stack.getItem() instanceof SandPaperItem && tag.contains("Polishing"))
spawnItemEffects = ItemStack.read(tag.getCompound("Polishing"));
if (stack.isFood())
spawnItemEffects = stack.copy();
if (!player.getActiveItemStack().isEmpty())
player.setHeldItem(hand, stack.onItemUseFinish(world, player));
player.resetActiveHand();
}
protected void returnAndDeposit() {
@ -504,6 +517,10 @@ public class DeployerTileEntity extends KineticTileEntity {
compound.putFloat("Reach", reach);
if (player != null)
compound.put("HeldItem", player.getHeldItemMainhand().serializeNBT());
if (spawnItemEffects != null) {
compound.put("Particle", spawnItemEffects.serializeNBT());
spawnItemEffects = null;
}
return super.writeToClient(compound);
}
@ -512,6 +529,12 @@ public class DeployerTileEntity extends KineticTileEntity {
reach = tag.getFloat("Reach");
if (tag.contains("HeldItem"))
heldItem = ItemStack.read(tag.getCompound("HeldItem"));
if (tag.contains("Particle")) {
ItemStack particleStack = ItemStack.read(tag.getCompound("Particle"));
SandPaperItem.spawnParticles(VecHelper.getCenterOf(pos).add(getMovementVector().scale(2f)), particleStack,
this.world);
}
super.readClientUpdate(tag);
}

View file

@ -3,19 +3,19 @@ package com.simibubi.create.modules.contraptions.components.fan;
import java.util.List;
import com.simibubi.create.AllRecipes;
import com.simibubi.create.modules.contraptions.processing.ProcessingIngredient;
import com.simibubi.create.modules.contraptions.processing.ProcessingOutput;
import com.simibubi.create.modules.contraptions.processing.ProcessingRecipe;
import com.simibubi.create.modules.contraptions.processing.StochasticOutput;
import com.simibubi.create.modules.logistics.InWorldProcessing;
import com.simibubi.create.modules.logistics.InWorldProcessing.SplashingInv;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
public class SplashingRecipe extends ProcessingRecipe<InWorldProcessing.SplashingInv> {
public SplashingRecipe(ResourceLocation id, String group, List<Ingredient> ingredients,
List<StochasticOutput> results, int processingDuration) {
public SplashingRecipe(ResourceLocation id, String group, List<ProcessingIngredient> ingredients,
List<ProcessingOutput> results, int processingDuration) {
super(AllRecipes.SPLASHING, id, group, ingredients, results, processingDuration);
}
@ -25,5 +25,10 @@ public class SplashingRecipe extends ProcessingRecipe<InWorldProcessing.Splashin
return false;
return ingredients.get(0).test(inv.getStackInSlot(0));
}
@Override
protected int getMaxOutputCount() {
return 6;
}
}

View file

@ -7,8 +7,9 @@ import java.util.List;
import com.simibubi.create.AllRecipes;
import com.simibubi.create.modules.contraptions.processing.BasinTileEntity.BasinInputInventory;
import com.simibubi.create.modules.contraptions.processing.ProcessingIngredient;
import com.simibubi.create.modules.contraptions.processing.ProcessingOutput;
import com.simibubi.create.modules.contraptions.processing.ProcessingRecipe;
import com.simibubi.create.modules.contraptions.processing.StochasticOutput;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
@ -19,11 +20,26 @@ import net.minecraft.world.World;
public class MixingRecipe extends ProcessingRecipe<BasinInputInventory> {
public MixingRecipe(ResourceLocation id, String group, List<Ingredient> ingredients, List<StochasticOutput> results,
int processingDuration) {
public MixingRecipe(ResourceLocation id, String group, List<ProcessingIngredient> ingredients,
List<ProcessingOutput> results, int processingDuration) {
super(AllRecipes.MIXING, id, group, ingredients, results, processingDuration);
}
@Override
protected int getMaxInputCount() {
return 9;
}
@Override
protected int getMaxOutputCount() {
return 1;
}
@Override
protected boolean canHaveCatalysts() {
return true;
}
@Override
public boolean matches(BasinInputInventory inv, World worldIn) {
if (inv.isEmpty())
@ -56,12 +72,11 @@ public class MixingRecipe extends ProcessingRecipe<BasinInputInventory> {
return false;
}
return true;
}
public static MixingRecipe of(IRecipe<?> recipe) {
return new MixingRecipe(recipe.getId(), recipe.getGroup(), recipe.getIngredients(),
Arrays.asList(new StochasticOutput(recipe.getRecipeOutput(), 1)), -1);
return new MixingRecipe(recipe.getId(), recipe.getGroup(), ProcessingIngredient.list(recipe.getIngredients()),
Arrays.asList(new ProcessingOutput(recipe.getRecipeOutput(), 1)), -1);
}
}

View file

@ -4,17 +4,17 @@ import java.util.List;
import com.simibubi.create.AllRecipes;
import com.simibubi.create.modules.contraptions.components.press.MechanicalPressTileEntity.PressingInv;
import com.simibubi.create.modules.contraptions.processing.ProcessingIngredient;
import com.simibubi.create.modules.contraptions.processing.ProcessingOutput;
import com.simibubi.create.modules.contraptions.processing.ProcessingRecipe;
import com.simibubi.create.modules.contraptions.processing.StochasticOutput;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
public class PressingRecipe extends ProcessingRecipe<MechanicalPressTileEntity.PressingInv> {
public PressingRecipe(ResourceLocation id, String group, List<Ingredient> ingredients,
List<StochasticOutput> results, int processingDuration) {
public PressingRecipe(ResourceLocation id, String group, List<ProcessingIngredient> ingredients,
List<ProcessingOutput> results, int processingDuration) {
super(AllRecipes.PRESSING, id, group, ingredients, results, processingDuration);
}
@ -24,5 +24,10 @@ public class PressingRecipe extends ProcessingRecipe<MechanicalPressTileEntity.P
return false;
return ingredients.get(0).test(inv.getStackInSlot(0));
}
@Override
protected int getMaxOutputCount() {
return 2;
}
}

View file

@ -3,18 +3,18 @@ package com.simibubi.create.modules.contraptions.components.saw;
import java.util.List;
import com.simibubi.create.AllRecipes;
import com.simibubi.create.modules.contraptions.processing.ProcessingIngredient;
import com.simibubi.create.modules.contraptions.processing.ProcessingInventory;
import com.simibubi.create.modules.contraptions.processing.ProcessingOutput;
import com.simibubi.create.modules.contraptions.processing.ProcessingRecipe;
import com.simibubi.create.modules.contraptions.processing.StochasticOutput;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
public class CuttingRecipe extends ProcessingRecipe<ProcessingInventory> {
public CuttingRecipe(ResourceLocation id, String group, List<Ingredient> ingredients,
List<StochasticOutput> results, int processingDuration) {
public CuttingRecipe(ResourceLocation id, String group, List<ProcessingIngredient> ingredients,
List<ProcessingOutput> results, int processingDuration) {
super(AllRecipes.CUTTING, id, group, ingredients, results, processingDuration);
}
@ -24,5 +24,10 @@ public class CuttingRecipe extends ProcessingRecipe<ProcessingInventory> {
return false;
return ingredients.get(0).test(inv.getStackInSlot(0));
}
@Override
protected int getMaxOutputCount() {
return 4;
}
}

View file

@ -120,6 +120,8 @@ public abstract class BasinOperatingTileEntity extends KineticTileEntity {
IItemHandlerModifiable inputs = inv.getInputHandler();
IItemHandlerModifiable outputs = inv.getOutputHandler();
List<ItemStack> catalysts = new ArrayList<>();
int buckets = 0;
Ingredients: for (Ingredient ingredient : lastRecipe.getIngredients()) {
for (int slot = 0; slot < inputs.getSlots(); slot++) {
@ -128,6 +130,12 @@ public abstract class BasinOperatingTileEntity extends KineticTileEntity {
ItemStack extracted = inputs.extractItem(slot, 1, false);
if (extracted.getItem() instanceof BucketItem)
buckets++;
if ((lastRecipe instanceof ProcessingRecipe)) {
ProcessingRecipe<?> pr = (ProcessingRecipe<?>) lastRecipe;
if (pr.getRollableIngredients().get(slot).remains())
catalysts.add(extracted.copy());
}
continue Ingredients;
}
// something wasn't found
@ -137,6 +145,7 @@ public abstract class BasinOperatingTileEntity extends KineticTileEntity {
ItemHandlerHelper.insertItemStacked(outputs, lastRecipe.getRecipeOutput().copy(), false);
if (buckets > 0)
ItemHandlerHelper.insertItemStacked(outputs, new ItemStack(Items.BUCKET, buckets), false);
catalysts.forEach(c -> ItemHandlerHelper.insertItemStacked(outputs, c, false));
// Continue mixing
gatherInputs();

View file

@ -0,0 +1,72 @@
package com.simibubi.create.modules.contraptions.processing;
import java.util.List;
import java.util.Random;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import com.google.gson.JsonObject;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.network.PacketBuffer;
public class ProcessingIngredient implements Predicate<ItemStack> {
private float outputChance;
private Ingredient ingredient;
private static Random r = new Random();
public ProcessingIngredient(Ingredient ingredient) {
this(ingredient, 0);
}
public ProcessingIngredient(Ingredient ingredient, float outputChance) {
this.ingredient = ingredient;
this.outputChance = outputChance;
}
public float getOutputChance() {
return outputChance;
}
public boolean isCatalyst() {
return outputChance > 0;
}
public static ProcessingIngredient parse(PacketBuffer buffer) {
Ingredient ingredient = Ingredient.read(buffer);
return new ProcessingIngredient(ingredient, buffer.readFloat());
}
public static ProcessingIngredient parse(JsonObject json) {
Ingredient ingredient = Ingredient.deserialize(json);
float chance = 0;
if (json.has("return_chance"))
chance = json.get("return_chance").getAsFloat();
return new ProcessingIngredient(ingredient, chance);
}
public void write(PacketBuffer buffer) {
getIngredient().write(buffer);
buffer.writeFloat(outputChance);
}
@Override
public boolean test(ItemStack t) {
return ingredient.test(t);
}
public Ingredient getIngredient() {
return ingredient;
}
public static List<ProcessingIngredient> list(List<Ingredient> ingredients) {
return ingredients.stream().map(ProcessingIngredient::new).collect(Collectors.toList());
}
public boolean remains() {
return r.nextFloat() <= outputChance;
}
}

View file

@ -5,13 +5,13 @@ import java.util.Random;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
public class StochasticOutput {
public class ProcessingOutput {
private static Random r = new Random();
private ItemStack stack;
private float chance;
public StochasticOutput(ItemStack stack, float chance) {
public ProcessingOutput(ItemStack stack, float chance) {
this.stack = stack;
this.chance = chance;
}
@ -37,8 +37,8 @@ public class StochasticOutput {
buf.writeFloat(getChance());
}
public static StochasticOutput read(PacketBuffer buf) {
return new StochasticOutput(buf.readItemStack(), buf.readFloat());
public static ProcessingOutput read(PacketBuffer buf) {
return new ProcessingOutput(buf.readItemStack(), buf.readFloat());
}
}

View file

@ -5,6 +5,7 @@ import java.util.List;
import java.util.stream.Collectors;
import com.simibubi.create.AllRecipes;
import com.simibubi.create.Create;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
@ -16,16 +17,16 @@ import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
public abstract class ProcessingRecipe<T extends IInventory> implements IRecipe<T> {
protected final List<Ingredient> ingredients;
private final List<StochasticOutput> results;
protected final List<ProcessingIngredient> ingredients;
private final List<ProcessingOutput> results;
private final IRecipeType<?> type;
private final IRecipeSerializer<?> serializer;
protected final ResourceLocation id;
protected final String group;
protected final int processingDuration;
public ProcessingRecipe(AllRecipes recipeType, ResourceLocation id, String group, List<Ingredient> ingredients,
List<StochasticOutput> results, int processingDuration) {
public ProcessingRecipe(AllRecipes recipeType, ResourceLocation id, String group,
List<ProcessingIngredient> ingredients, List<ProcessingOutput> results, int processingDuration) {
this.type = recipeType.type;
this.serializer = recipeType.serializer;
this.id = id;
@ -33,12 +34,27 @@ public abstract class ProcessingRecipe<T extends IInventory> implements IRecipe<
this.ingredients = ingredients;
this.results = results;
this.processingDuration = processingDuration;
validate(recipeType);
}
private void validate(AllRecipes recipeType) {
if (ingredients.size() > getMaxInputCount())
Create.logger.warn("Your custom " + recipeType.name() + " recipe (" + id.toString() + ") has more inputs ("
+ ingredients.size() + ") than supported (" + getMaxInputCount() + ").");
if (results.size() > getMaxOutputCount())
Create.logger.warn("Your custom " + recipeType.name() + " recipe (" + id.toString() + ") has more outputs ("
+ results.size() + ") than supported (" + getMaxOutputCount() + ").");
ingredients.forEach(i -> {
if (i.isCatalyst() && !canHaveCatalysts())
Create.logger.warn("Your custom " + recipeType.name() + " recipe (" + id.toString()
+ ") has a catalyst ingredient, which act like a regular ingredient in this type.");
});
}
@Override
public NonNullList<Ingredient> getIngredients() {
NonNullList<Ingredient> nonnulllist = NonNullList.create();
nonnulllist.addAll(this.ingredients);
this.ingredients.forEach(e -> nonnulllist.add(e.getIngredient()));
return nonnulllist;
}
@ -48,7 +64,7 @@ public abstract class ProcessingRecipe<T extends IInventory> implements IRecipe<
public List<ItemStack> rollResults() {
List<ItemStack> stacks = new ArrayList<>();
for (StochasticOutput output : getRollableResults()) {
for (ProcessingOutput output : getRollableResults()) {
ItemStack stack = output.rollOutput();
if (!stack.isEmpty())
stacks.add(stack);
@ -91,9 +107,25 @@ public abstract class ProcessingRecipe<T extends IInventory> implements IRecipe<
return type;
}
public List<StochasticOutput> getRollableResults() {
protected int getMaxInputCount() {
return 1;
}
protected int getMaxOutputCount() {
return 15;
}
protected boolean canHaveCatalysts() {
return false;
}
public List<ProcessingOutput> getRollableResults() {
return results;
}
public List<ProcessingIngredient> getRollableIngredients() {
return ingredients;
}
public List<ItemStack> getPossibleOutputs() {
return getRollableResults().stream().map(output -> output.getStack()).collect(Collectors.toList());

View file

@ -8,7 +8,6 @@ import com.google.gson.JsonObject;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.JSONUtils;
import net.minecraft.util.ResourceLocation;
@ -27,12 +26,12 @@ public class ProcessingRecipeSerializer<T extends ProcessingRecipe<?>>
public T read(ResourceLocation recipeId, JsonObject json) {
String s = JSONUtils.getString(json, "group", "");
List<Ingredient> ingredients = new ArrayList<>();
List<ProcessingIngredient> ingredients = new ArrayList<>();
for (JsonElement e : JSONUtils.getJsonArray(json, "ingredients")) {
ingredients.add(Ingredient.deserialize(e));
ingredients.add(ProcessingIngredient.parse(e.getAsJsonObject()));
}
List<StochasticOutput> results = new ArrayList<>();
List<ProcessingOutput> results = new ArrayList<>();
for (JsonElement e : JSONUtils.getJsonArray(json, "results")) {
String s1 = JSONUtils.getString(e.getAsJsonObject().get("item"), "item");
int i = JSONUtils.getInt(e.getAsJsonObject().get("count"), "count");
@ -40,7 +39,7 @@ public class ProcessingRecipeSerializer<T extends ProcessingRecipe<?>>
if (JSONUtils.hasField((JsonObject) e, "chance"))
chance = JSONUtils.getFloat(e.getAsJsonObject().get("chance"), "chance");
ItemStack itemstack = new ItemStack(Registry.ITEM.getOrDefault(new ResourceLocation(s1)), i);
results.add(new StochasticOutput(itemstack, chance));
results.add(new ProcessingOutput(itemstack, chance));
}
int duration = -1;
@ -53,15 +52,15 @@ public class ProcessingRecipeSerializer<T extends ProcessingRecipe<?>>
public T read(ResourceLocation recipeId, PacketBuffer buffer) {
String s = buffer.readString(32767);
List<Ingredient> ingredients = new ArrayList<>();
List<ProcessingIngredient> ingredients = new ArrayList<>();
int ingredientCount = buffer.readInt();
for (int i = 0; i < ingredientCount; i++)
ingredients.add(Ingredient.read(buffer));
ingredients.add(ProcessingIngredient.parse(buffer));
List<StochasticOutput> results = new ArrayList<>();
List<ProcessingOutput> results = new ArrayList<>();
int outputCount = buffer.readInt();
for (int i = 0; i < outputCount; i++)
results.add(StochasticOutput.read(buffer));
results.add(ProcessingOutput.read(buffer));
int duration = buffer.readInt();
@ -81,7 +80,7 @@ public class ProcessingRecipeSerializer<T extends ProcessingRecipe<?>>
}
public interface IRecipeFactory<T extends ProcessingRecipe<?>> {
T create(ResourceLocation id, String group, List<Ingredient> ingredients, List<StochasticOutput> results,
T create(ResourceLocation id, String group, List<ProcessingIngredient> ingredients, List<ProcessingOutput> results,
int duration);
}

View file

@ -6,8 +6,8 @@ import java.util.List;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems;
import com.simibubi.create.foundation.block.IWithTileEntity;
import com.simibubi.create.foundation.block.IHaveNoBlockItem;
import com.simibubi.create.foundation.block.IWithTileEntity;
import com.simibubi.create.foundation.utility.AllShapes;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.modules.contraptions.base.HorizontalKineticBlock;
@ -163,7 +163,7 @@ public class BeltBlock extends HorizontalKineticBlock implements IHaveNoBlockIte
return false;
ItemStack heldItem = player.getHeldItem(handIn);
boolean isShaft = heldItem.getItem() == AllBlocks.SHAFT.get().asItem();
boolean isCasing = heldItem.getItem() == AllBlocks.LOGISTICAL_CASING.get().asItem();
boolean isCasing = heldItem.getItem() == AllBlocks.BRASS_CASING.get().asItem();
boolean isDye = Tags.Items.DYES.contains(heldItem.getItem());
boolean isHand = heldItem.isEmpty() && handIn == Hand.MAIN_HAND;
@ -238,7 +238,7 @@ public class BeltBlock extends HorizontalKineticBlock implements IHaveNoBlockIte
return ActionResultType.SUCCESS;
world.setBlockState(context.getPos(), state.with(CASING, false), 3);
if (!player.isCreative())
player.inventory.placeItemBackInInventory(world, new ItemStack(AllBlocks.LOGISTICAL_CASING.block));
player.inventory.placeItemBackInInventory(world, new ItemStack(AllBlocks.BRASS_CASING.block));
return ActionResultType.SUCCESS;
}

View file

@ -24,8 +24,8 @@ import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.Direction.AxisDirection;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.common.util.Constants.NBT;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;

View file

@ -23,12 +23,12 @@ public class ChromaticCompoundCubeItem extends Item implements IItemWithColorHan
float progress = (float) ((mc.player.getYaw(pt)) / 180 * Math.PI)
+ (AnimationTickHolder.getRenderTick() * 1f);
if (layer == 0)
return ColorHelper.mixColors(0xDDDDDD, 0xDDDDDD, ((float) MathHelper.sin(progress) + 1) / 2);
return ColorHelper.mixColors(0x6e5773, 0x6B3074, ((float) MathHelper.sin(progress) + 1) / 2);
if (layer == 1)
return ColorHelper.mixColors(0x72A498, 0xB9D6FF,
return ColorHelper.mixColors(0xd45d79, 0x6e5773,
((float) MathHelper.sin((float) (progress + Math.PI)) + 1) / 2);
if (layer == 2)
return ColorHelper.mixColors(0x5082CE, 0x91C5B7,
return ColorHelper.mixColors(0xea9085, 0xd45d79,
((float) MathHelper.sin((float) (progress * 1.5f + Math.PI)) + 1) / 2);
return 0;
}

View file

@ -1,9 +1,9 @@
package com.simibubi.create.modules.curiosities.placementHandgun;
package com.simibubi.create.modules.curiosities.blockzapper;
import java.util.function.Supplier;
import com.simibubi.create.foundation.packet.SimplePacketBase;
import com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunHandler.LaserBeam;
import com.simibubi.create.modules.curiosities.blockzapper.BlockzapperHandler.LaserBeam;
import net.minecraft.client.Minecraft;
import net.minecraft.network.PacketBuffer;
@ -14,21 +14,21 @@ import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.network.NetworkEvent.Context;
public class BuilderGunBeamPacket extends SimplePacketBase {
public class BlockzapperBeamPacket extends SimplePacketBase {
public Vec3d start;
public Vec3d target;
public Hand hand;
public boolean self;
public BuilderGunBeamPacket(Vec3d start, Vec3d target, Hand hand, boolean self) {
public BlockzapperBeamPacket(Vec3d start, Vec3d target, Hand hand, boolean self) {
this.start = start;
this.target = target;
this.hand = hand;
this.self = self;
}
public BuilderGunBeamPacket(PacketBuffer buffer) {
public BlockzapperBeamPacket(PacketBuffer buffer) {
start = new Vec3d(buffer.readDouble(), buffer.readDouble(), buffer.readDouble());
target = new Vec3d(buffer.readDouble(), buffer.readDouble(), buffer.readDouble());
hand = buffer.readBoolean()? Hand.MAIN_HAND : Hand.OFF_HAND;
@ -51,12 +51,12 @@ public class BuilderGunBeamPacket extends SimplePacketBase {
context.get().enqueueWork(() -> DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> {
if (Minecraft.getInstance().player.getPositionVector().distanceTo(start) > 100)
return;
BuilderGunHandler.addBeam(new LaserBeam(start, target).followPlayer(self, hand == Hand.MAIN_HAND));
BlockzapperHandler.addBeam(new LaserBeam(start, target).followPlayer(self, hand == Hand.MAIN_HAND));
if (self)
BuilderGunHandler.shoot(hand);
BlockzapperHandler.shoot(hand);
else
BuilderGunHandler.playSound(hand, new BlockPos(start));
BlockzapperHandler.playSound(hand, new BlockPos(start));
}));
context.get().setPacketHandled(true);
}

View file

@ -1,4 +1,4 @@
package com.simibubi.create.modules.curiosities.placementHandgun;
package com.simibubi.create.modules.curiosities.blockzapper;
import java.util.LinkedList;
import java.util.List;
@ -21,8 +21,6 @@ import net.minecraft.client.renderer.entity.PlayerRenderer;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.NBTUtil;
import net.minecraft.particles.ParticleTypes;
import net.minecraft.util.Hand;
import net.minecraft.util.HandSide;
@ -37,14 +35,12 @@ import net.minecraftforge.client.event.RenderSpecificHandEvent;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.event.TickEvent.ClientTickEvent;
import net.minecraftforge.event.TickEvent.Phase;
import net.minecraftforge.event.world.BlockEvent.BreakEvent;
import net.minecraftforge.eventbus.api.EventPriority;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
@SuppressWarnings("deprecation")
@EventBusSubscriber(value = Dist.CLIENT)
public class BuilderGunHandler {
public class BlockzapperHandler {
public static List<LaserBeam> cachedBeams;
public static float leftHandAnimation;
@ -94,19 +90,19 @@ public class BuilderGunHandler {
return barrelPos;
}
@SubscribeEvent(priority = EventPriority.HIGHEST)
public static void onBlockBroken(BreakEvent event) {
PlayerEntity player = event.getPlayer();
if (player == null)
return;
if (!AllItems.PLACEMENT_HANDGUN.typeOf(player.getHeldItemMainhand()))
return;
if (event.getState().isNormalCube(player.world, event.getPos())) {
player.getHeldItemMainhand().getTag().put("BlockUsed", NBTUtil.writeBlockState(event.getState()));
}
event.setCanceled(true);
}
// @SubscribeEvent(priority = EventPriority.HIGHEST)
// public static void onBlockBroken(BreakEvent event) {
// PlayerEntity player = event.getPlayer();
// if (player == null)
// return;
// if (!AllItems.PLACEMENT_HANDGUN.typeOf(player.getHeldItemMainhand()))
// return;
//
// if (event.getState().isNormalCube(player.world, event.getPos())) {
// player.getHeldItemMainhand().getTag().put("BlockUsed", NBTUtil.writeBlockState(event.getState()));
// }
// event.setCanceled(true);
// }
@SubscribeEvent
public static void onClientTick(ClientTickEvent event) {

View file

@ -1,4 +1,4 @@
package com.simibubi.create.modules.curiosities.placementHandgun;
package com.simibubi.create.modules.curiosities.blockzapper;
import java.util.HashSet;
import java.util.LinkedList;
@ -16,6 +16,7 @@ import com.simibubi.create.foundation.item.ItemDescription;
import com.simibubi.create.foundation.item.ItemDescription.Palette;
import com.simibubi.create.foundation.utility.BlockHelper;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.NBTHelper;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
@ -63,10 +64,10 @@ import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.network.PacketDistributor;
public class BuilderGunItem extends Item {
public class BlockzapperItem extends Item {
public static enum ComponentTier {
None(TextFormatting.DARK_GRAY), BlazeBrass(TextFormatting.GOLD), ChorusChrome(TextFormatting.LIGHT_PURPLE),
None(TextFormatting.DARK_GRAY), Brass(TextFormatting.GOLD), Chromatic(TextFormatting.LIGHT_PURPLE),
;
@ -75,16 +76,22 @@ public class BuilderGunItem extends Item {
private ComponentTier(TextFormatting color) {
this.color = color;
}
}
public static enum Components {
Body, Amplifier, Accelerator, Retriever, Scope
}
public BuilderGunItem(Properties properties) {
public BlockzapperItem(Properties properties) {
super(properties.maxStackSize(1).rarity(Rarity.UNCOMMON));
}
@Override
public boolean canPlayerBreakBlockWhileHolding(BlockState state, World worldIn, BlockPos pos, PlayerEntity player) {
return false;
}
@Override
public UseAction getUseAction(ItemStack stack) {
return UseAction.NONE;
@ -121,12 +128,12 @@ public class BuilderGunItem extends Item {
ItemStack gunWithGoldStuff = new ItemStack(this);
for (Components c : Components.values())
setTier(c, ComponentTier.BlazeBrass, gunWithGoldStuff);
setTier(c, ComponentTier.Brass, gunWithGoldStuff);
items.add(gunWithGoldStuff);
ItemStack gunWithPurpurStuff = new ItemStack(this);
for (Components c : Components.values())
setTier(c, ComponentTier.ChorusChrome, gunWithPurpurStuff);
setTier(c, ComponentTier.Chromatic, gunWithPurpurStuff);
items.add(gunWithPurpurStuff);
}
super.fillItemGroup(group, items);
@ -214,7 +221,7 @@ public class BuilderGunItem extends Item {
// Client side
if (world.isRemote) {
BuilderGunHandler.dontAnimateItem(hand);
BlockzapperHandler.dontAnimateItem(hand);
return new ActionResult<ItemStack>(ActionResultType.SUCCESS, item);
}
@ -254,9 +261,9 @@ public class BuilderGunItem extends Item {
applyCooldown(player, item, gunInOtherHand);
AllPackets.channel.send(PacketDistributor.TRACKING_ENTITY.with(() -> player),
new BuilderGunBeamPacket(barrelPos, raytrace.getHitVec(), hand, false));
new BlockzapperBeamPacket(barrelPos, raytrace.getHitVec(), hand, false));
AllPackets.channel.send(PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity) player),
new BuilderGunBeamPacket(barrelPos, raytrace.getHitVec(), hand, true));
new BlockzapperBeamPacket(barrelPos, raytrace.getHitVec(), hand, true));
return new ActionResult<ItemStack>(ActionResultType.SUCCESS, item);
@ -362,7 +369,7 @@ public class BuilderGunItem extends Item {
@OnlyIn(Dist.CLIENT)
private void openHandgunGUI(ItemStack handgun, boolean offhand) {
ScreenOpener.open(new BuilderGunScreen(handgun, offhand));
ScreenOpener.open(new BlockzapperScreen(handgun, offhand));
}
public static List<BlockPos> getSelectedBlocks(ItemStack stack, World worldIn, PlayerEntity player) {
@ -462,9 +469,9 @@ public class BuilderGunItem extends Item {
return false;
if (tier == ComponentTier.None)
return blockHardness < 3;
if (tier == ComponentTier.BlazeBrass)
if (tier == ComponentTier.Brass)
return blockHardness < 6;
if (tier == ComponentTier.ChorusChrome)
if (tier == ComponentTier.Chromatic)
return true;
return false;
@ -474,9 +481,9 @@ public class BuilderGunItem extends Item {
ComponentTier tier = getTier(Components.Amplifier, stack);
if (tier == ComponentTier.None)
return 2;
if (tier == ComponentTier.BlazeBrass)
if (tier == ComponentTier.Brass)
return 4;
if (tier == ComponentTier.ChorusChrome)
if (tier == ComponentTier.Chromatic)
return 8;
return 0;
@ -486,9 +493,9 @@ public class BuilderGunItem extends Item {
ComponentTier tier = getTier(Components.Accelerator, stack);
if (tier == ComponentTier.None)
return 10;
if (tier == ComponentTier.BlazeBrass)
if (tier == ComponentTier.Brass)
return 6;
if (tier == ComponentTier.ChorusChrome)
if (tier == ComponentTier.Chromatic)
return 2;
return 20;
@ -498,9 +505,9 @@ public class BuilderGunItem extends Item {
ComponentTier tier = getTier(Components.Scope, stack);
if (tier == ComponentTier.None)
return 15;
if (tier == ComponentTier.BlazeBrass)
if (tier == ComponentTier.Brass)
return 30;
if (tier == ComponentTier.ChorusChrome)
if (tier == ComponentTier.Chromatic)
return 100;
return 0;
@ -545,10 +552,10 @@ public class BuilderGunItem extends Item {
Block.spawnDrops(worldIn.getBlockState(placed), worldIn, placed.offset(face), tileentity);
}
if (getTier(Components.Retriever, item) == ComponentTier.BlazeBrass)
if (getTier(Components.Retriever, item) == ComponentTier.Brass)
Block.spawnDrops(worldIn.getBlockState(placed), worldIn, playerIn.getPosition(), tileentity);
if (getTier(Components.Retriever, item) == ComponentTier.ChorusChrome)
if (getTier(Components.Retriever, item) == ComponentTier.Chromatic)
for (ItemStack stack : Block.getDrops(worldIn.getBlockState(placed), (ServerWorld) worldIn, placed,
tileentity))
if (!playerIn.inventory.addItemStackToInventory(stack))
@ -563,11 +570,11 @@ public class BuilderGunItem extends Item {
public static ComponentTier getTier(Components component, ItemStack stack) {
if (!stack.hasTag() || !stack.getTag().contains(component.name()))
stack.getOrCreateTag().putString(component.name(), ComponentTier.None.name());
return ComponentTier.valueOf(stack.getTag().getString(component.name()));
return NBTHelper.readEnum(stack.getTag().getString(component.name()), ComponentTier.class);
}
public static void setTier(Components component, ComponentTier tier, ItemStack stack) {
stack.getOrCreateTag().putString(component.name(), tier.name());
stack.getOrCreateTag().putString(component.name(), NBTHelper.writeEnum(tier));
}
}

View file

@ -1,16 +1,16 @@
package com.simibubi.create.modules.curiosities.placementHandgun;
package com.simibubi.create.modules.curiosities.blockzapper;
import static com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunItem.Components.Accelerator;
import static com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunItem.Components.Amplifier;
import static com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunItem.Components.Body;
import static com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunItem.Components.Retriever;
import static com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunItem.Components.Scope;
import static com.simibubi.create.modules.curiosities.blockzapper.BlockzapperItem.Components.Accelerator;
import static com.simibubi.create.modules.curiosities.blockzapper.BlockzapperItem.Components.Amplifier;
import static com.simibubi.create.modules.curiosities.blockzapper.BlockzapperItem.Components.Body;
import static com.simibubi.create.modules.curiosities.blockzapper.BlockzapperItem.Components.Retriever;
import static com.simibubi.create.modules.curiosities.blockzapper.BlockzapperItem.Components.Scope;
import com.mojang.blaze3d.platform.GLX;
import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunItem.ComponentTier;
import com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunItem.Components;
import com.simibubi.create.modules.curiosities.blockzapper.BlockzapperItem.ComponentTier;
import com.simibubi.create.modules.curiosities.blockzapper.BlockzapperItem.Components;
import net.minecraft.block.BlockState;
import net.minecraft.block.FourWayBlock;
@ -24,12 +24,12 @@ import net.minecraft.nbt.NBTUtil;
import net.minecraft.util.HandSide;
import net.minecraft.util.math.MathHelper;
public class BuilderGunItemRenderer extends ItemStackTileEntityRenderer {
public class BlockzapperItemRenderer extends ItemStackTileEntityRenderer {
@Override
public void renderByItem(ItemStack stack) {
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
BuilderGunModel mainModel = (BuilderGunModel) itemRenderer.getModelWithOverrides(stack);
BlockzapperModel mainModel = (BlockzapperModel) itemRenderer.getModelWithOverrides(stack);
float pt = Minecraft.getInstance().getRenderPartialTicks();
float worldTime = AnimationTickHolder.getRenderTick();
@ -53,10 +53,10 @@ public class BuilderGunItemRenderer extends ItemStackTileEntityRenderer {
boolean leftHanded = player.getPrimaryHand() == HandSide.LEFT;
boolean mainHand = player.getHeldItemMainhand() == stack;
boolean offHand = player.getHeldItemOffhand() == stack;
float last = mainHand ^ leftHanded ? BuilderGunHandler.lastRightHandAnimation
: BuilderGunHandler.lastLeftHandAnimation;
float current = mainHand ^ leftHanded ? BuilderGunHandler.rightHandAnimation
: BuilderGunHandler.leftHandAnimation;
float last = mainHand ^ leftHanded ? BlockzapperHandler.lastRightHandAnimation
: BlockzapperHandler.lastLeftHandAnimation;
float current = mainHand ^ leftHanded ? BlockzapperHandler.rightHandAnimation
: BlockzapperHandler.leftHandAnimation;
float animation = MathHelper.clamp(MathHelper.lerp(pt, last, current) * 5, 0, 1);
// Core glows
@ -67,7 +67,7 @@ public class BuilderGunItemRenderer extends ItemStackTileEntityRenderer {
}
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, multiplier * 240, 120);
itemRenderer.renderItem(stack, mainModel.core);
if (BuilderGunItem.getTier(Amplifier, stack) != ComponentTier.None)
if (BlockzapperItem.getTier(Amplifier, stack) != ComponentTier.None)
itemRenderer.renderItem(stack, mainModel.ampCore);
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, lastCoordx, lastCoordy);
GlStateManager.enableLighting();
@ -91,7 +91,7 @@ public class BuilderGunItemRenderer extends ItemStackTileEntityRenderer {
BlockState state = NBTUtil.readBlockState(stack.getTag().getCompound("BlockUsed"));
GlStateManager.pushMatrix();
GlStateManager.translatef(-0.8F, -0.7F, -0.5F);
GlStateManager.translatef(-0.3F, -0.45F, -0.0F);
GlStateManager.scalef(0.25F, 0.25F, 0.25F);
IBakedModel modelForState = Minecraft.getInstance().getBlockRendererDispatcher().getModelForState(state);
@ -105,9 +105,9 @@ public class BuilderGunItemRenderer extends ItemStackTileEntityRenderer {
public void renderComponent(ItemStack stack, Components component, ItemRenderer itemRenderer, IBakedModel none,
IBakedModel gold, IBakedModel chorus) {
ComponentTier tier = BuilderGunItem.getTier(component, stack);
ComponentTier tier = BlockzapperItem.getTier(component, stack);
IBakedModel model = tier == ComponentTier.ChorusChrome ? chorus : gold;
IBakedModel model = tier == ComponentTier.Chromatic ? chorus : gold;
if (tier == ComponentTier.None) {
if (none == null)
return;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.modules.curiosities.placementHandgun;
package com.simibubi.create.modules.curiosities.blockzapper;
import java.util.Arrays;
import java.util.List;
@ -14,7 +14,7 @@ import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
import net.minecraftforge.client.event.ModelBakeEvent;
@SuppressWarnings("deprecation")
public class BuilderGunModel extends CustomRenderItemBakedModel {
public class BlockzapperModel extends CustomRenderItemBakedModel {
public boolean showBlock;
@ -35,7 +35,7 @@ public class BuilderGunModel extends CustomRenderItemBakedModel {
public IBakedModel chorusRetriever;
public IBakedModel chorusAcc;
public BuilderGunModel(IBakedModel template) {
public BlockzapperModel(IBakedModel template) {
super(template);
}

View file

@ -1,4 +1,4 @@
package com.simibubi.create.modules.curiosities.placementHandgun;
package com.simibubi.create.modules.curiosities.blockzapper;
import java.util.Collections;
import java.util.Vector;
@ -35,7 +35,7 @@ import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.client.model.data.EmptyModelData;
@SuppressWarnings("deprecation")
public class BuilderGunScreen extends AbstractSimiScreen {
public class BlockzapperScreen extends AbstractSimiScreen {
private ItemStack item;
private boolean offhand;
@ -57,7 +57,7 @@ public class BuilderGunScreen extends AbstractSimiScreen {
private Vector<IconButton> patternButtons;
public BuilderGunScreen(ItemStack handgun, boolean offhand) {
public BlockzapperScreen(ItemStack handgun, boolean offhand) {
super();
item = handgun;
this.offhand = offhand;
@ -93,12 +93,12 @@ public class BuilderGunScreen extends AbstractSimiScreen {
spreadMaterialButton.setToolTip(Lang.translate("gui.blockzapper.searchFuzzy"));
spreadRangeLabel = new Label(i + 119, j + 46, "").withShadow().withSuffix("m");
spreadRangeInput = new ScrollInput(i + 115, j + 43, 22, 14).withRange(1, BuilderGunItem.getMaxAoe(item))
spreadRangeInput = new ScrollInput(i + 115, j + 43, 22, 14).withRange(1, BlockzapperItem.getMaxAoe(item))
.setState(1).titled(Lang.translate("gui.blockzapper.range")).writingTo(spreadRangeLabel);
if (nbt.contains("SearchDistance"))
spreadRangeInput.setState(nbt.getInt("SearchDistance"));
if (BuilderGunItem.getMaxAoe(item) == 2)
if (BlockzapperItem.getMaxAoe(item) == 2)
spreadRangeInput.getToolTip().add(1, TextFormatting.RED + needsUpgradedAmplifier);
Collections.addAll(widgets, replaceModeButton, replaceModeIndicator, spreadDiagonallyButton,

View file

@ -1,10 +1,10 @@
package com.simibubi.create.modules.curiosities.placementHandgun;
package com.simibubi.create.modules.curiosities.blockzapper;
import com.google.gson.JsonObject;
import com.simibubi.create.AllItems;
import com.simibubi.create.AllRecipes;
import com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunItem.ComponentTier;
import com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunItem.Components;
import com.simibubi.create.modules.curiosities.blockzapper.BlockzapperItem.ComponentTier;
import com.simibubi.create.modules.curiosities.blockzapper.BlockzapperItem.Components;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.item.ItemStack;
@ -19,13 +19,13 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.registries.ForgeRegistryEntry;
public class BuilderGunUpgradeRecipe implements ICraftingRecipe {
public class BlockzapperUpgradeRecipe implements ICraftingRecipe {
private ShapedRecipe recipe;
private Components component;
private ComponentTier tier;
public BuilderGunUpgradeRecipe(ShapedRecipe recipe, Components component, ComponentTier tier) {
public BlockzapperUpgradeRecipe(ShapedRecipe recipe, Components component, ComponentTier tier) {
this.recipe = recipe;
this.component = component;
this.tier = tier;
@ -47,7 +47,7 @@ public class BuilderGunUpgradeRecipe implements ICraftingRecipe {
ItemStack handgun = inv.getStackInSlot(slot).copy();
if (!AllItems.PLACEMENT_HANDGUN.typeOf(handgun))
continue;
BuilderGunItem.setTier(getUpgradedComponent(), getTier(), handgun);
BlockzapperItem.setTier(getUpgradedComponent(), getTier(), handgun);
return handgun;
}
return ItemStack.EMPTY;
@ -56,7 +56,7 @@ public class BuilderGunUpgradeRecipe implements ICraftingRecipe {
@Override
public ItemStack getRecipeOutput() {
ItemStack handgun = new ItemStack(AllItems.PLACEMENT_HANDGUN.get());
BuilderGunItem.setTier(getUpgradedComponent(), getTier(), handgun);
BlockzapperItem.setTier(getUpgradedComponent(), getTier(), handgun);
return handgun;
}
@ -80,28 +80,28 @@ public class BuilderGunUpgradeRecipe implements ICraftingRecipe {
return AllRecipes.BLOCKZAPPER_UPGRADE.serializer;
}
public static class Serializer extends ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<BuilderGunUpgradeRecipe> {
public static class Serializer extends ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<BlockzapperUpgradeRecipe> {
@Override
public BuilderGunUpgradeRecipe read(ResourceLocation recipeId, JsonObject json) {
public BlockzapperUpgradeRecipe read(ResourceLocation recipeId, JsonObject json) {
ShapedRecipe recipe = IRecipeSerializer.CRAFTING_SHAPED.read(recipeId, json);
Components component = Components.valueOf(JSONUtils.getString(json, "component"));
ComponentTier tier = ComponentTier.valueOf(JSONUtils.getString(json, "tier"));
return new BuilderGunUpgradeRecipe(recipe, component, tier);
return new BlockzapperUpgradeRecipe(recipe, component, tier);
}
@Override
public BuilderGunUpgradeRecipe read(ResourceLocation recipeId, PacketBuffer buffer) {
public BlockzapperUpgradeRecipe read(ResourceLocation recipeId, PacketBuffer buffer) {
ShapedRecipe recipe = IRecipeSerializer.CRAFTING_SHAPED.read(recipeId, buffer);
Components component = Components.valueOf(buffer.readString(buffer.readInt()));
ComponentTier tier = ComponentTier.valueOf(buffer.readString(buffer.readInt()));
return new BuilderGunUpgradeRecipe(recipe, component, tier);
return new BlockzapperUpgradeRecipe(recipe, component, tier);
}
@Override
public void write(PacketBuffer buffer, BuilderGunUpgradeRecipe recipe) {
public void write(PacketBuffer buffer, BlockzapperUpgradeRecipe recipe) {
IRecipeSerializer.CRAFTING_SHAPED.write(buffer, recipe.getRecipe());
String name = recipe.getUpgradedComponent().name();

View file

@ -1,4 +1,4 @@
package com.simibubi.create.modules.curiosities.placementHandgun;
package com.simibubi.create.modules.curiosities.blockzapper;
import com.simibubi.create.ScreenResources;
import com.simibubi.create.foundation.utility.Lang;

View file

@ -4,8 +4,8 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import com.simibubi.create.foundation.block.IWithTileEntity;
import com.simibubi.create.foundation.block.IHaveNoBlockItem;
import com.simibubi.create.foundation.block.IWithTileEntity;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;

View file

@ -10,23 +10,39 @@ import net.minecraft.util.LazyLoadBase;
public enum AllToolTiers implements IItemTier {
BLAZING(3, 750, 10.0F, 2.5F, 16, () -> {
return Ingredient.fromItems(AllItems.BLAZE_BRASS_CUBE.item);
}),
// BLAZING(3, 750, 10.0F, 2.5F, 16, () -> {
// return Ingredient.fromItems(AllItems.BLAZE_BRASS_CUBE.item);
// }),
ROSE_QUARTZ(3, 1644, 7.0F, 2.0F, 24, () -> {
return Ingredient.fromItems(AllItems.REFINED_ROSE_QUARTZ.item);
return Ingredient.fromItems(AllItems.POLISHED_ROSE_QUARTZ.item);
}),
SHADOW_STEEL(4, 2303, 16.0F, 3.5F, 10, () -> {
return Ingredient.fromItems(AllItems.SHADOW_STEEL_CUBE.item);
return Ingredient.fromItems(AllItems.SHADOW_STEEL.item);
}),
RADIANT(4, 2303, 16.0F, 3.5F, 10, () -> {
return Ingredient.fromItems(AllItems.REFINED_RADIANCE_CUBE.item);
return Ingredient.fromItems(AllItems.REFINED_RADIANCE.item);
}),
;
/* used to belong to AllItems. Banished here until harvest events exist */
// BLAZING_PICKAXE(new BlazingToolItem(1, -2.8F, standardProperties(), PICKAXE)),
// BLAZING_SHOVEL(new BlazingToolItem(1.5F, -3.0F, standardProperties(), SHOVEL)),
// BLAZING_AXE(new BlazingToolItem(5.0F, -3.0F, standardProperties(), AXE)),
// BLAZING_SWORD(new BlazingToolItem(3, -2.4F, standardProperties(), SWORD)),
//
// ROSE_QUARTZ_PICKAXE(new RoseQuartzToolItem(1, -2.8F, standardProperties(), PICKAXE)),
// ROSE_QUARTZ_SHOVEL(new RoseQuartzToolItem(1.5F, -3.0F, standardProperties(), SHOVEL)),
// ROSE_QUARTZ_AXE(new RoseQuartzToolItem(5.0F, -3.0F, standardProperties(), AXE)),
// ROSE_QUARTZ_SWORD(new RoseQuartzToolItem(3, -2.4F, standardProperties(), SWORD)),
//
// SHADOW_STEEL_PICKAXE(new ShadowSteelToolItem(2.5F, -2.0F, standardProperties(), PICKAXE)),
// SHADOW_STEEL_MATTOCK(new ShadowSteelToolItem(2.5F, -1.5F, standardProperties(), SHOVEL, AXE, HOE)),
// SHADOW_STEEL_SWORD(new ShadowSteelToolItem(3, -2.0F, standardProperties(), SWORD)),
private final int harvestLevel;
private final int maxUses;

View file

@ -0,0 +1,169 @@
package com.simibubi.create.modules.curiosities.tools;
import com.simibubi.create.foundation.utility.VecHelper;
import com.simibubi.create.modules.contraptions.components.deployer.DeployerFakePlayer;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.item.UseAction;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.particles.ItemParticleData;
import net.minecraft.particles.ParticleTypes;
import net.minecraft.util.ActionResult;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceContext;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
public class SandPaperItem extends Item {
public SandPaperItem(Properties properties) {
super(properties);
}
@Override
public UseAction getUseAction(ItemStack stack) {
return UseAction.EAT;
}
@Override
public ActionResultType onItemUse(ItemUseContext context) {
return ActionResultType.PASS;
}
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) {
ItemStack itemstack = playerIn.getHeldItem(handIn);
ActionResult<ItemStack> FAIL = new ActionResult<>(ActionResultType.FAIL, itemstack);
if (itemstack.getOrCreateTag().contains("Polishing")) {
playerIn.setActiveHand(handIn);
return new ActionResult<>(ActionResultType.PASS, itemstack);
}
RayTraceResult raytraceresult = rayTrace(worldIn, playerIn, RayTraceContext.FluidMode.NONE);
if (!(raytraceresult instanceof BlockRayTraceResult))
return FAIL;
BlockRayTraceResult ray = (BlockRayTraceResult) raytraceresult;
Vec3d hitVec = ray.getHitVec();
if (hitVec == null)
return FAIL;
AxisAlignedBB bb = new AxisAlignedBB(hitVec, hitVec).grow(1f);
ItemEntity pickUp = null;
for (ItemEntity itemEntity : worldIn.getEntitiesWithinAABB(ItemEntity.class, bb)) {
if (itemEntity.getPositionVec().distanceTo(playerIn.getPositionVec()) > 3)
continue;
ItemStack stack = itemEntity.getItem();
if (!SandPaperPolishingRecipe.canPolish(worldIn, stack))
continue;
pickUp = itemEntity;
break;
}
if (pickUp == null)
return FAIL;
ItemStack item = pickUp.getItem().copy();
ItemStack toPolish = item.split(1);
playerIn.setActiveHand(handIn);
if (!worldIn.isRemote) {
itemstack.getOrCreateTag().put("Polishing", toPolish.serializeNBT());
if (item.isEmpty())
pickUp.remove();
else
pickUp.setItem(item);
}
return new ActionResult<>(ActionResultType.SUCCESS, itemstack);
}
@Override
public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) {
return enchantment == Enchantments.FORTUNE || super.canApplyAtEnchantingTable(stack, enchantment);
}
@Override
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, LivingEntity entityLiving) {
if (!(entityLiving instanceof PlayerEntity))
return stack;
PlayerEntity player = (PlayerEntity) entityLiving;
CompoundNBT tag = stack.getOrCreateTag();
if (tag.contains("Polishing")) {
ItemStack toPolish = ItemStack.read(tag.getCompound("Polishing"));
ItemStack polished = SandPaperPolishingRecipe.applyPolish(worldIn, entityLiving.getPositionVec(), toPolish,
stack);
if (worldIn.isRemote) {
spawnParticles(entityLiving.getEyePosition(1).add(entityLiving.getLookVec().scale(.5f)), toPolish,
worldIn);
return stack;
}
if (!polished.isEmpty()) {
if (player instanceof DeployerFakePlayer) {
player.dropItem(polished, false, false);
} else
player.inventory.placeItemBackInInventory(worldIn, polished);
}
tag.remove("Polishing");
stack.damageItem(1, entityLiving, p -> p.sendBreakAnimation(p.getActiveHand()));
}
return stack;
}
public static void spawnParticles(Vec3d location, ItemStack polishedStack, World world) {
for (int i = 0; i < 20; i++) {
Vec3d motion = VecHelper.offsetRandomly(Vec3d.ZERO, world.rand, 1 / 8f);
world.addParticle(new ItemParticleData(ParticleTypes.ITEM, polishedStack), location.x, location.y,
location.z, motion.x, motion.y, motion.z);
}
}
@Override
public void onPlayerStoppedUsing(ItemStack stack, World worldIn, LivingEntity entityLiving, int timeLeft) {
if (!(entityLiving instanceof PlayerEntity))
return;
PlayerEntity player = (PlayerEntity) entityLiving;
CompoundNBT tag = stack.getOrCreateTag();
if (tag.contains("Polishing")) {
ItemStack toPolish = ItemStack.read(tag.getCompound("Polishing"));
player.inventory.placeItemBackInInventory(worldIn, toPolish);
tag.remove("Polishing");
}
}
@Override
public int getUseDuration(ItemStack stack) {
return 32;
}
@Override
public int getItemStackLimit(ItemStack stack) {
return 1;
}
@Override
public boolean isDamageable() {
return true;
}
@Override
public int getMaxDamage(ItemStack stack) {
return 8;
}
}

View file

@ -0,0 +1,103 @@
package com.simibubi.create.modules.curiosities.tools;
import javax.vecmath.Matrix4f;
import org.apache.commons.lang3.tuple.Pair;
import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.foundation.block.render.CustomRenderItemBakedModel;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.client.event.ModelBakeEvent;
@SuppressWarnings("deprecation")
public class SandPaperItemRenderer extends ItemStackTileEntityRenderer {
@Override
public void renderByItem(ItemStack stack) {
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
ClientPlayerEntity player = Minecraft.getInstance().player;
SandPaperModel mainModel = (SandPaperModel) itemRenderer.getModelWithOverrides(stack);
float partialTicks = Minecraft.getInstance().getRenderPartialTicks();
boolean leftHand = mainModel.transformType == TransformType.FIRST_PERSON_LEFT_HAND;
boolean firstPerson = leftHand || mainModel.transformType == TransformType.FIRST_PERSON_RIGHT_HAND;
GlStateManager.pushMatrix();
GlStateManager.translatef(.5f, .5f, .5f);
CompoundNBT tag = stack.getOrCreateTag();
if (tag.contains("Polishing")) {
GlStateManager.pushMatrix();
if (mainModel.transformType == TransformType.GUI) {
GlStateManager.translatef(0.0F, .2f, 1.0F);
GlStateManager.scalef(.75f, .75f, .75f);
} else {
int modifier = leftHand ? -1 : 1;
GlStateManager.rotatef(modifier * 40, 0, 1, 0);
}
// Reverse bobbing
float time = (float) player.getItemInUseCount() - partialTicks + 1.0F;
if (time / (float) stack.getUseDuration() < 0.8F) {
float bobbing = -MathHelper.abs(MathHelper.cos(time / 4.0F * (float) Math.PI) * 0.1F);
if (mainModel.transformType == TransformType.GUI)
GlStateManager.translatef(bobbing, bobbing, 0.0F);
else
GlStateManager.translatef(0.0f, bobbing, 0.0F);
}
ItemStack toPolish = ItemStack.read(tag.getCompound("Polishing"));
itemRenderer.renderItem(toPolish, itemRenderer.getModelWithOverrides(toPolish).getBakedModel());
GlStateManager.popMatrix();
}
if (firstPerson) {
int itemInUseCount = player.getItemInUseCount();
if (itemInUseCount > 0) {
int modifier = leftHand ? -1 : 1;
GlStateManager.translatef(modifier * .5f, 0, -.25f);
GlStateManager.rotatef(modifier * 40, 0, 0, 1);
GlStateManager.rotatef(modifier * 10, 1, 0, 0);
GlStateManager.rotatef(modifier * 90, 0, 1, 0);
}
}
itemRenderer.renderItem(stack, mainModel.getBakedModel());
GlStateManager.popMatrix();
}
public static class SandPaperModel extends CustomRenderItemBakedModel {
TransformType transformType;
public SandPaperModel(IBakedModel template) {
super(template);
}
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(TransformType cameraTransformType) {
transformType = cameraTransformType;
return super.handlePerspective(cameraTransformType);
}
@Override
public CustomRenderItemBakedModel loadPartials(ModelBakeEvent event) {
return this;
}
}
}

View file

@ -0,0 +1,101 @@
package com.simibubi.create.modules.curiosities.tools;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.simibubi.create.AllRecipes;
import com.simibubi.create.modules.contraptions.processing.ProcessingIngredient;
import com.simibubi.create.modules.contraptions.processing.ProcessingOutput;
import com.simibubi.create.modules.contraptions.processing.ProcessingRecipe;
import com.simibubi.create.modules.curiosities.tools.SandPaperPolishingRecipe.SandPaperInv;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.DamageSource;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.Explosion.Mode;
import net.minecraft.world.World;
import net.minecraftforge.items.ItemStackHandler;
import net.minecraftforge.items.wrapper.RecipeWrapper;
public class SandPaperPolishingRecipe extends ProcessingRecipe<SandPaperInv> {
public static DamageSource CURSED_POLISHING = new DamageSource("create.curse_polish").setExplosion();
public SandPaperPolishingRecipe(ResourceLocation id, String group, List<ProcessingIngredient> ingredients,
List<ProcessingOutput> results, int processingDuration) {
super(AllRecipes.SANDPAPER_POLISHING, id, group, ingredients, results, processingDuration);
}
public static boolean canPolish(World world, ItemStack stack) {
return stack.isDamageable() || !getMatchingRecipes(world, stack).isEmpty();
}
public static ItemStack applyPolish(World world, Vec3d position, ItemStack stack, ItemStack sandPaperStack) {
List<IRecipe<SandPaperInv>> matchingRecipes = getMatchingRecipes(world, stack);
if (!matchingRecipes.isEmpty())
return matchingRecipes.get(0).getCraftingResult(new SandPaperInv(stack)).copy();
if (stack.isDamageable()) {
stack.setDamage(stack.getDamage() - (stack.getMaxDamage() - stack.getDamage()) / 2);
int fortuneLevel = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, sandPaperStack);
float chanceToPunish = (float) (1 / Math.pow(2, fortuneLevel + 1));
if (world.rand.nextFloat() > chanceToPunish)
return stack;
if (stack.isEnchanted()) {
Map<Enchantment, Integer> enchantments = EnchantmentHelper.getEnchantments(stack);
ArrayList<Enchantment> list = new ArrayList<>(enchantments.keySet());
Enchantment randomKey = list.get(world.rand.nextInt(list.size()));
int level = enchantments.get(randomKey);
if (level <= 1)
enchantments.remove(randomKey);
else
enchantments.put(randomKey, level - 1);
EnchantmentHelper.setEnchantments(enchantments, stack);
if (randomKey.isCurse())
if (!world.isRemote)
world.createExplosion(null, CURSED_POLISHING, position.x, position.y, position.z, 2, true,
Mode.DESTROY);
} else {
stack = ItemStack.EMPTY;
}
}
return stack;
}
@Override
public boolean matches(SandPaperInv inv, World worldIn) {
return ingredients.get(0).test(inv.getStackInSlot(0));
}
public static List<IRecipe<SandPaperInv>> getMatchingRecipes(World world, ItemStack stack) {
return world.getRecipeManager().getRecipes(AllRecipes.SANDPAPER_POLISHING.getType(), new SandPaperInv(stack),
world);
}
@Override
protected int getMaxOutputCount() {
return 1;
}
public static class SandPaperInv extends RecipeWrapper {
public SandPaperInv(ItemStack stack) {
super(new ItemStackHandler(1));
inv.setStackInSlot(0, stack);
}
}
}

View file

@ -14,8 +14,8 @@ import net.minecraft.state.BooleanProperty;
import net.minecraft.state.StateContainer.Builder;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.shapes.ISelectionContext;

View file

@ -17,7 +17,6 @@ import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
import com.simibubi.create.modules.contraptions.relays.belt.BeltTileEntity;
import com.simibubi.create.modules.logistics.block.belts.AttachedLogisticalBlock;
import com.simibubi.create.modules.logistics.item.CardboardBoxItem;
import com.simibubi.create.modules.logistics.transport.CardboardBoxEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.ItemEntity;
@ -70,8 +69,8 @@ public class ExtractorTileEntity extends SmartTileEntity {
entityPos = entityPos.add(0, .5, 0);
if (stack.getItem() instanceof CardboardBoxItem) {
entityIn = new CardboardBoxEntity(world, entityPos, stack, facing.getOpposite());
world.playSound(null, getPos(), SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.BLOCKS, .25f, .05f);
// entityIn = new CardboardBoxEntity(world, entityPos, stack, facing.getOpposite());
// world.playSound(null, getPos(), SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.BLOCKS, .25f, .05f);
} else {
entityIn = new ItemEntity(world, entityPos.x, entityPos.y, entityPos.z, stack);

View file

@ -10,8 +10,8 @@ import com.simibubi.create.modules.logistics.block.belts.AttachedLogisticalBlock
import net.minecraft.block.BlockState;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.IBlockReader;

View file

@ -118,8 +118,6 @@ public class FilterItem extends Item implements INamedContainerProvider {
ItemStack heldItem = player.getHeldItem(hand);
if (!player.isSneaking() && hand == Hand.MAIN_HAND) {
if (AllItems.LOGISTICAL_FILTER.typeOf(heldItem))
return ActionResult.newResult(ActionResultType.FAIL, heldItem);
if (!world.isRemote && player instanceof ServerPlayerEntity)
NetworkHooks.openGui((ServerPlayerEntity) player, this, buf -> {
buf.writeItemStack(heldItem);

View file

@ -87,13 +87,6 @@ public abstract class LogisticalActorTileEntity extends SyncedTileEntity
return colorFromUUID(networkId);
}
public static int colorFromUUID(UUID uuid) {
if (uuid == null)
return 0x333333;
int rainbowColor = ColorHelper.rainbowColor((int) uuid.getLeastSignificantBits());
return ColorHelper.mixColors(rainbowColor, 0xFFFFFF, .5f);
}
public <T> LazyOptional<T> getCasingCapability(Capability<T> cap, Direction side) {
return LazyOptional.empty();
}

View file

@ -18,9 +18,9 @@ import java.util.List;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems;
import com.simibubi.create.Create;
import com.simibubi.create.foundation.block.IHaveNoBlockItem;
import com.simibubi.create.foundation.block.IWithContainer;
import com.simibubi.create.foundation.block.IWithTileEntity;
import com.simibubi.create.foundation.block.IHaveNoBlockItem;
import com.simibubi.create.foundation.block.RenderUtilityBlock;
import com.simibubi.create.foundation.utility.AllShapes;
import com.simibubi.create.modules.logistics.management.base.LogisticalCasingBlock.Part;

View file

@ -1,10 +1,10 @@
package com.simibubi.create.modules.palettes;
import com.simibubi.create.foundation.block.connected.CTSpriteShifter;
import com.simibubi.create.foundation.block.connected.CTSpriteShifter.CTType;
import com.simibubi.create.foundation.block.connected.ConnectedTextureBehaviour;
import com.simibubi.create.foundation.block.connected.IHaveConnectedTextures;
import com.simibubi.create.foundation.block.connected.StandardCTBehaviour;
import com.simibubi.create.foundation.block.connected.CTSpriteShifter.CTType;
import net.minecraft.block.Blocks;
import net.minecraft.block.GlassBlock;

View file

@ -6,11 +6,9 @@
"item.create.placement_handgun": "Handheld Blockzapper",
"item.create.tree_fertilizer": "Tree Fertilizer",
"item.create.empty_blueprint": "Empty Schematic",
"item.create.andesite_alloy_cube": "Andesite Alloy",
"item.create.blaze_brass_cube": "Blaze Brass",
"item.create.chorus_chrome_cube": "Chorus Chrome",
"item.create.chromatic_compound_cube": "Chromatic Compound",
"item.create.shadow_steel_cube": "Shadow Steel",
"item.create.andesite_alloy": "Andesite Alloy",
"item.create.chromatic_compound": "Chromatic Compound",
"item.create.shadow_steel": "Shadow Steel",
"item.create.blueprint_and_quill": "Schematic and Quill",
"item.create.blueprint": "Schematic",
"item.create.belt_connector": "Mechanical Belt",
@ -19,10 +17,12 @@
"item.create.property_filter": "Attribute Filter",
"item.create.logistical_filter": "Address Filter",
"item.create.rose_quartz": "Rose Quartz",
"item.create.refined_rose_quartz": "Refined Rose Quartz",
"item.create.refined_radiance_cube": "Refined Radiance",
"item.create.polished_rose_quartz": "Polished Rose Quartz",
"item.create.refined_radiance": "Refined Radiance",
"item.create.iron_sheet": "Iron Sheets",
"item.create.gold_sheet": "Gold Sheets",
"item.create.lapis_plate": "Lapis Plating",
"item.create.obsidian_dust": "Powdered Obsidian",
"item.create.propeller": "Propeller",
"item.create.flour": "Wheat Flour",
"item.create.dough": "Dough",
@ -30,20 +30,23 @@
"item.create.deforester": "Deforester",
"item.create.crushed_iron": "Crushed Iron Ore",
"item.create.crushed_gold": "Crushed Gold Ore",
"item.create.sand_paper": "Sand Paper",
"item.create.red_sand_paper": "Red Sand Paper",
"item.create.brass_cube": "Brass",
"item.create.brass_ingot": "Brass Ingot",
"item.create.brass_sheet": "Brass Sheets",
"item.create.brass_nugget": "Brass Nugget",
"item.create.crushed_brass": "Crushed Brass",
"item.create.zinc_cube": "Zinc Bar",
"item.create.zinc_ingot": "Zinc Bar",
"item.create.zinc_nugget": "Zinc Nugget",
"item.create.crushed_zinc": "Crushed Zinc",
"item.create.copper_sheet": "Copper Sheets",
"item.create.copper_ingot": "Copper Ingot",
"item.create.copper_nugget": "Copper Nugget",
"item.create.crushed_copper": "Crushed Copper",
"item.create.electron_tube": "Electron Tube",
"item.create.circuit": "Integrated Circuit",
"item.create.integrated_circuit": "Integrated Circuit",
"item.create.logistical_controller_supply": "Item Supply",
"item.create.logistical_controller_request": "Item Request",
@ -210,6 +213,7 @@
"death.attack.create.fan_lava": "%1$s was burned to death by lava fan",
"death.attack.create.drill": "%1$s was impaled by Mechanical Drill",
"create.block.deployer.damage_source_name": "a rogue Deployer",
"death.attack.create.curse_polish": "%1$s tried to polish a cursed item",
"create.recipe.crushing": "Crushing",
"create.recipe.splashing": "Bulk Washing",
@ -224,7 +228,9 @@
"create.recipe.sawing": "Sawing",
"create.recipe.block_cutting": "Block Cutting",
"create.recipe.blockzapperUpgrade": "Handheld Blockzapper",
"create.recipe.processing.catalyst": "Catalyst",
"create.recipe.processing.chance": "%1$s%% Chance",
"create.recipe.processing.chanceToReturn": "%1$s%% Chance to return",
"create.generic.range": "Range",
"create.generic.radius": "Radius",
@ -283,8 +289,8 @@
"create.blockzapper.component.retriever": "Retriever",
"create.blockzapper.component.scope": "Scope",
"create.blockzapper.componentTier.none": "None",
"create.blockzapper.componentTier.blazebrass": "Blaze Brass",
"create.blockzapper.componentTier.choruschrome": "Chorus Chrome",
"create.blockzapper.componentTier.brass": "Brass",
"create.blockzapper.componentTier.chromatic": "Chromatic",
"create.blockzapper.leftClickToSet": "Left-Click a Block to set Material",
"create.blockzapper.empty": "Out of Blocks!",

View file

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

View file

@ -1,6 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "create:item/brass_cube"
"layer0": "create:item/brass_ingot"
}
}

View file

@ -2,8 +2,8 @@
"__comment": "Model generated using MrCrayfish's Model Creator (https://mrcrayfish.com/tools?id=mc)",
"parent": "block/block",
"textures": {
"particle": "create:item/cardboard_box_particle",
"cardboard_box_1410": "create:item/cardboard_box_1410"
"particle": "create:entity/cardboard_box/particle",
"cardboard_box_1410": "create:entity/cardboard_box/box_1410"
},
"elements": [
{

View file

@ -2,8 +2,8 @@
"__comment": "Model generated using MrCrayfish's Model Creator (https://mrcrayfish.com/tools?id=mc)",
"parent": "block/block",
"textures": {
"particle": "create:item/cardboard_box_particle",
"cardboard_box_1416": "create:item/cardboard_box_1416"
"particle": "create:entity/cardboard_box/particle",
"cardboard_box_1416": "create:entity/cardboard_box/box_1416"
},
"elements": [
{

View file

@ -2,8 +2,8 @@
"__comment": "Model generated using MrCrayfish's Model Creator (https://mrcrayfish.com/tools?id=mc)",
"parent": "block/block",
"textures": {
"particle": "create:item/cardboard_box_particle",
"cardboard_box_1612": "create:item/cardboard_box_1612"
"particle": "create:entity/cardboard_box/particle",
"cardboard_box_1612": "create:entity/cardboard_box/box_1612"
},
"elements": [
{

View file

@ -2,8 +2,8 @@
"__comment": "Model generated using MrCrayfish's Model Creator (https://mrcrayfish.com/tools?id=mc)",
"parent": "block/block",
"textures": {
"particle": "create:item/cardboard_box_particle",
"cardboard_box_1616": "create:item/cardboard_box_1616"
"particle": "create:entity/cardboard_box/particle",
"cardboard_box_1616": "create:entity/cardboard_box/box_1616"
},
"elements": [
{

View file

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

View file

@ -1,6 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "create:item/chorus_chrome_cube"
"layer0": "create:item/integrated_circuit"
}
}

View file

@ -1,6 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "create:item/microchip"
"layer0": "create:item/lapis_plate"
}
}

View file

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

View file

@ -1,66 +1,71 @@
{
"__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)",
"ambientocclusion": true,
"display": {
"firstperson_righthand": {
"rotation": [ 10, 0, 10 ],
"translation": [ 1, 4, 1],
"scale":[ 1, 1, 1 ]
},
"thirdperson_righthand": {
"rotation": [ 15, 0, 0 ],
"translation": [ 0, 4, -2.5],
"scale":[ 0.8, 0.8, 0.8 ]
},
"gui": {
"rotation": [ 42, 315, 0 ],
"translation": [ -1, 3, 0],
"scale":[ 1, 1, 1 ]
},
"ground": {
"rotation": [ 0, 0, 0 ],
"translation": [ 0, 4.2, 0],
"scale":[ 0.4, 0.4, 0.4 ]
},
"fixed": {
"rotation": [ 0, 90, 0 ],
"translation": [ 0, -5, 0 ],
"scale": [ 1, 1, 1 ]
}
},
"textures": {
"smooth_stone_slab_side": "block/smooth_stone_slab_side",
"4": "minecraft:block/obsidian",
"credit": "Made with Blockbench",
"textures": {
"0": "block/obsidian",
"1": "block/smooth_stone_slab_side",
"particle": "block/obsidian"
},
"elements": [
{
"name": "Grip",
"from": [ 7.1, 1, 12 ],
"to": [ 8.9, 5, 15 ],
"rotation": { "origin": [ 8, 2, 14 ], "axis": "x", "angle": -22.5 },
"faces": {
"north": { "texture": "#smooth_stone_slab_side", "uv": [ 5, 7, 6.8, 11 ] },
"east": { "texture": "#smooth_stone_slab_side", "uv": [ 13, 7, 16, 11 ] },
"south": { "texture": "#smooth_stone_slab_side", "uv": [ 7, 7, 8.8, 11 ] },
"west": { "texture": "#smooth_stone_slab_side", "uv": [ 16, 7, 13, 11 ] },
"up": { "texture": "#smooth_stone_slab_side", "uv": [ 5, 2, 6.8, 5 ] },
"down": { "texture": "#smooth_stone_slab_side", "uv": [ 7, 11, 8.8, 14 ] }
}
},
{
"name": "Trigger",
"from": [ 7.5, 3, 11 ],
"to": [ 8.5, 6, 13 ],
"rotation": { "origin": [ 8, 2, 14 ], "axis": "x", "angle": -22.5 },
"faces": {
"north": { "texture": "#4", "uv": [ 6, 4, 7, 7 ] },
"east": { "texture": "#4", "uv": [ 6, 4, 8, 7 ] },
"south": { "texture": "#4", "uv": [ 6, 4, 7, 7 ] },
"west": { "texture": "#4", "uv": [ 5, 4, 7, 7 ] },
"up": { "texture": "#4", "uv": [ 6, 6, 7, 8 ] },
"down": { "texture": "#4", "uv": [ 5, 6, 6, 8 ] }
}
}
]
},
"elements": [
{
"name": "Grip",
"from": [7.1, 1, 12],
"to": [8.9, 5, 15],
"rotation": {"angle": -22.5, "axis": "x", "origin": [8, 2, 14]},
"faces": {
"north": {"uv": [5, 7, 6.8, 11], "texture": "#1"},
"east": {"uv": [13, 7, 16, 11], "texture": "#1"},
"south": {"uv": [7, 7, 8.8, 11], "texture": "#1"},
"west": {"uv": [16, 7, 13, 11], "texture": "#1"},
"up": {"uv": [5, 2, 6.8, 5], "texture": "#1"},
"down": {"uv": [7, 11, 8.8, 14], "texture": "#1"}
}
},
{
"name": "Trigger",
"from": [7.5, 3, 11],
"to": [8.5, 6, 13],
"rotation": {"angle": -22.5, "axis": "x", "origin": [8, 2, 14]},
"faces": {
"north": {"uv": [6, 4, 7, 7], "texture": "#0"},
"east": {"uv": [6, 4, 8, 7], "texture": "#0"},
"south": {"uv": [6, 4, 7, 7], "texture": "#0"},
"west": {"uv": [5, 4, 7, 7], "texture": "#0"},
"up": {"uv": [6, 6, 7, 8], "texture": "#0"},
"down": {"uv": [5, 6, 6, 8], "texture": "#0"}
}
}
],
"display": {
"thirdperson_righthand": {
"rotation": [1, 0, 0],
"translation": [0, 4, -2.5],
"scale": [0.8, 0.8, 0.8]
},
"thirdperson_lefthand": {
"rotation": [1, 0, 0],
"translation": [0, 4, -2.5],
"scale": [0.8, 0.8, 0.8]
},
"firstperson_righthand": {
"rotation": [10, 0, 10],
"translation": [1, 4, 1]
},
"firstperson_lefthand": {
"rotation": [10, 0, 10],
"translation": [1, 4, 1]
},
"ground": {
"rotation": [0, 0, 90],
"translation": [-2.25, -1, -0.75],
"scale": [0.75, 0.75, 0.75]
},
"gui": {
"rotation": [30, 45, 0],
"translation": [-0.5, 3.5, 0]
},
"fixed": {
"rotation": [0, 90, 0],
"translation": [-1.25, 4.25, -1]
}
}
}

View file

@ -1,6 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "create:item/andesite_alloy_cube"
"layer0": "create:item/polished_rose_quartz"
}
}

View file

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

View file

@ -1,6 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "create:item/blaze_brass_cube"
"layer0": "create:item/refined_radiance"
}
}

View file

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

View file

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

View file

@ -1,6 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "create:item/circuit"
"layer0": "create:item/sand_paper"
}
}

View file

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

View file

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

View file

@ -1,10 +0,0 @@
{
"parent": "create:block/shop_shelf",
"display": {
"gui": {
"rotation": [ 30, 45, 0 ],
"translation": [ 0, 0, 0],
"scale":[ 0.625, 0.625, 0.625 ]
}
}
}

View file

@ -1,6 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "create:item/zinc_cube"
"layer0": "create:item/zinc_ingot"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 662 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View file

Before

Width:  |  Height:  |  Size: 508 B

After

Width:  |  Height:  |  Size: 508 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 458 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 435 B

After

Width:  |  Height:  |  Size: 470 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 622 B

After

Width:  |  Height:  |  Size: 593 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 671 B

After

Width:  |  Height:  |  Size: 619 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 504 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 502 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

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