Skip to content

Commit

Permalink
✨ 添加神秘源质输出仓
Browse files Browse the repository at this point in the history
  • Loading branch information
warmthdawn committed Nov 26, 2021
1 parent c41437f commit dba54ec
Show file tree
Hide file tree
Showing 23 changed files with 667 additions and 338 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ processResources {

runClient {
args '--username', 'WarmthDawn'
jvmArgs '-Xms4G', '-Xmx4G'
jvmArgs '-Xms4G', '-Xmx8G'
}

def getBuildNumber() {
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/com/warmthdawn/mod/gugu_utils/ModBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import com.warmthdawn.mod.gugu_utils.common.Enables;
import com.warmthdawn.mod.gugu_utils.common.GenericBlock;
import com.warmthdawn.mod.gugu_utils.modularmachenary.IColorableTileEntity;
import com.warmthdawn.mod.gugu_utils.modularmachenary.aspect.BlockAspectInputHatch;
import com.warmthdawn.mod.gugu_utils.modularmachenary.aspect.TileAspectInputHatch;
import com.warmthdawn.mod.gugu_utils.modularmachenary.aspect.BlockAspectHatch;
import com.warmthdawn.mod.gugu_utils.modularmachenary.aspect.TileAspectHatch;
import com.warmthdawn.mod.gugu_utils.modularmachenary.aura.BlockAuraInputHatch;
import com.warmthdawn.mod.gugu_utils.modularmachenary.aura.TileAuraInputHatch;
import com.warmthdawn.mod.gugu_utils.modularmachenary.embers.BlockEmberInputHatch;
Expand Down Expand Up @@ -59,8 +59,8 @@ public class ModBlocks {
@GameRegistry.ObjectHolder(STRING_RESOURCE_ENERGYPORT_OUTPUT)
public static GenericBlock blockEnergyOutputPort;
//源质输入仓
@GameRegistry.ObjectHolder(STRING_RESOURCE_ASPECTHATCH_INPUT)
public static GenericBlock blockAspectInputHatch;
@GameRegistry.ObjectHolder(STRING_RESOURCE_ASPECTHATCH)
public static GenericBlock blockAspectHatch;
//气压输入输出仓
@GameRegistry.ObjectHolder(STRING_RESOURCE_PRESSUREHATCH)
public static GenericBlock blockPressureHatch;
Expand All @@ -82,7 +82,7 @@ public static void initModels() {
if (Enables.NATURES_AURA)
blockAuraInputHatch.initModel();
if(Enables.THAUMCRAFT)
blockAspectInputHatch.initModel();
blockAspectHatch.initModel();
if(Enables.PNEUMATICCRAFT)
blockPressureHatch.initModel();
if(Enables.PRODIGYTECH)
Expand Down Expand Up @@ -119,8 +119,8 @@ public static void register(IForgeRegistry<Block> registry) {
}

if(Enables.THAUMCRAFT){
registry.register(new BlockAspectInputHatch());
GameRegistry.registerTileEntity(TileAspectInputHatch.class, RESOURCE_ASPECTHATCH_INPUT);
registry.register(new BlockAspectHatch());
GameRegistry.registerTileEntity(TileAspectHatch.class, RESOURCE_ASPECTHATCH);
}

if(Enables.PNEUMATICCRAFT){
Expand Down Expand Up @@ -182,8 +182,8 @@ public static void registerDynamicColor() {
itemColors.registerItemColorHandler(mmItemColorMultiplier, Item.getItemFromBlock(blockAuraInputHatch));
}
if (Enables.THAUMCRAFT) {
blockColors.registerBlockColorHandler(mmBlockColorMultiplier, blockAspectInputHatch);
itemColors.registerItemColorHandler(mmItemColorMultiplier, Item.getItemFromBlock(blockAspectInputHatch));
blockColors.registerBlockColorHandler(mmBlockColorMultiplier, blockAspectHatch);
itemColors.registerItemColorHandler(mmItemColorMultiplier, Item.getItemFromBlock(blockAspectHatch));
}
if (Enables.PNEUMATICCRAFT) {
blockColors.registerBlockColorHandler(mmBlockColorMultiplier, blockPressureHatch);
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/warmthdawn/mod/gugu_utils/ModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.warmthdawn.mod.gugu_utils.common.Enables;
import com.warmthdawn.mod.gugu_utils.common.VariantItem;
import com.warmthdawn.mod.gugu_utils.config.TweaksConfig;
import com.warmthdawn.mod.gugu_utils.modularmachenary.aspect.BlockAspectHatch;
import com.warmthdawn.mod.gugu_utils.modularmachenary.embers.BlockEmberInputHatch;
import com.warmthdawn.mod.gugu_utils.modularmachenary.mana.BlockSparkManaHatch;
import com.warmthdawn.mod.gugu_utils.modularmachenary.mana.ItemManaBlock;
Expand Down Expand Up @@ -75,7 +76,7 @@ public static void register(IForgeRegistry<Item> registry) {
registry.register(new ItemBlock(ModBlocks.blockAuraInputHatch).setRegistryName(RESOURCE_AURAHATCH_INPUT));
}
if (Enables.THAUMCRAFT) {
registry.register(new ItemBlock(ModBlocks.blockAspectInputHatch).setRegistryName(RESOURCE_ASPECTHATCH_INPUT));
registry.register(new VariantItem<>((BlockAspectHatch)ModBlocks.blockAspectHatch).setRegistryName(RESOURCE_ASPECTHATCH));
}
if (Enables.PNEUMATICCRAFT) {
registry.register(new VariantItem<>((BlockPressureHatch) ModBlocks.blockPressureHatch).setRegistryName(RESOURCE_PRESSUREHATCH));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,14 @@ public class Constants {
public static final String STRING_RESOURCE_ENERGYPORT_OUTPUT = GuGuUtils.MODID + ":" + NAME_ENERGYPORT_OUTPUT;


public static final String NAME_ASPECTHATCH_INPUT = "aspectinputhatch";
public static final ResourceLocation RESOURCE_ASPECTHATCH_INPUT = new ResourceLocation(GuGuUtils.MODID, NAME_ASPECTHATCH_INPUT);
public static final String STRING_RESOURCE_ASPECTHATCH_INPUT = GuGuUtils.MODID + ":" + NAME_ASPECTHATCH_INPUT;
public static String getStringResource(String name) {
return GuGuUtils.MODID + ":"+ name;
}
public static final String NAME_ASPECTHATCH = "aspecthatch";
public static final ResourceLocation RESOURCE_ASPECTHATCH = new ResourceLocation(GuGuUtils.MODID, NAME_ASPECTHATCH);
public static final String STRING_RESOURCE_ASPECTHATCH = GuGuUtils.MODID + ":" + NAME_ASPECTHATCH;
public static final ResourceLocation RESOURCE_TILE_ASPECTHATCH_OUTPUT = new ResourceLocation(GuGuUtils.MODID, NAME_ASPECTHATCH + "_output");
public static final ResourceLocation RESOURCE_TILE_ASPECTHATCH_INPUT = new ResourceLocation(GuGuUtils.MODID, NAME_ASPECTHATCH + "_input");


public static final String NAME_PRESSUREHATCH = "pressurehatch";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.warmthdawn.mod.gugu_utils.config;

import com.warmthdawn.mod.gugu_utils.GuGuUtils;
import net.minecraftforge.common.config.Config;

@Config(modid = GuGuUtils.MODID, category = "Hatches")
public class HatchesConfig {
@Config.Comment("Max aspect in aspect output hatch")
public static int ASPECT_OUTPUT_HATCH_MAX_STORAGE = 500;
@Config.Comment("Actions when a aspect output hatch are full, can be 'spill_random', 'spill_all' and 'halt'.")
public static String ASPECT_OUTPUT_HATCH_FULL_ACTION = "spill_random";
}
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public static RecipePrimer addAspcetInput(RecipePrimer primer, int amount, Strin
if (aspect == null) {
GuGuUtils.logger.warn("Couldn't find aspect " + aspectTag);
}
primer.appendComponent(new RequirementAspect(amount, aspect, IOType.INPUT));
primer.appendComponent(RequirementAspect.createInput(amount, aspect));
return primer;
}

Expand All @@ -192,6 +192,21 @@ public static RecipePrimer addThaumcraftAspcetInput(RecipePrimer primer, int amo
return addAspcetInput(primer, amount, aspectTag);
}

@ZenMethod
public static RecipePrimer addAspcetOutput(RecipePrimer primer, int amount, String aspectTag) {
Aspect aspect = Aspect.getAspect(aspectTag);
if (aspect == null) {
GuGuUtils.logger.warn("Couldn't find aspect " + aspectTag);
}
primer.appendComponent(new RequirementAspectOutput(amount, aspect));
return primer;
}

@ZenMethod
public static RecipePrimer addThaumcraftAspcetOutput(RecipePrimer primer, int amount, String aspectTag) {
return addAspcetOutput(primer, amount, aspectTag);
}

//----------------------------------------------------------------------------------------------
// air
//----------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
package com.warmthdawn.mod.gugu_utils.modularmachenary.aspect;

import com.warmthdawn.mod.gugu_utils.GuGuUtils;
import com.warmthdawn.mod.gugu_utils.common.VariantBlock;
import com.warmthdawn.mod.gugu_utils.modularmachenary.common.IOHatchVariant;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.jetbrains.annotations.Nullable;
import thaumcraft.api.aspects.IEssentiaTransport;
import thaumcraft.api.aura.AuraHelper;
import thaumcraft.api.items.ItemsTC;
import thaumcraft.common.lib.SoundsTC;
import thaumcraft.common.tiles.devices.TileJarBrain;
import thaumcraft.common.tiles.essentia.TileJarFillable;
import thaumcraft.common.tiles.essentia.TileSmelter;

import javax.annotation.Nonnull;

import static com.warmthdawn.mod.gugu_utils.common.Constants.NAME_ASPECTHATCH;
import static com.warmthdawn.mod.gugu_utils.common.Constants.RESOURCE_ASPECTHATCH;
import static com.warmthdawn.mod.gugu_utils.tools.ResourceUtils.j;

public class BlockAspectHatch extends VariantBlock<IOHatchVariant> {

public static final PropertyEnum<IOHatchVariant> VARIANT = PropertyEnum.create("variant", IOHatchVariant.class);

public BlockAspectHatch() {
super(Material.ROCK, IOHatchVariant.class);
setHardness(2.0F);
setResistance(10.0F);
setSoundType(SoundType.STONE);
setHarvestLevel("pickaxe", 0);
setRegistryName(RESOURCE_ASPECTHATCH);
setTranslationKey(j(GuGuUtils.MODID, NAME_ASPECTHATCH));

}

@Override
public boolean eventReceived(IBlockState state, World worldIn, BlockPos pos, int id, int param) {
worldIn.markBlockRangeForRenderUpdate(pos, pos);
return true;
}

@Override
@Nonnull
@SideOnly(Side.CLIENT)
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}

@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
if (!worldIn.isRemote) {
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileAspectHatch) {
((TileAspectHatch) tileentity).spillAll();
}
}
super.breakBlock(worldIn, pos, state);
}

@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
TileEntity te = world.getTileEntity(pos);
if (te instanceof TileAspectHatch && player.isSneaking() && player.getHeldItem(hand).isEmpty()) {
if (world.isRemote) {
world.playSound((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, SoundsTC.jar, SoundCategory.BLOCKS, 0.4F, 1.0F, false);
world.playSound((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, SoundEvents.ITEM_BOTTLE_FILL, SoundCategory.BLOCKS, 0.5F, 1.0F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.3F, false);
} else {
((TileAspectHatch) te).spillAll();
}
return true;
}
return super.onBlockActivated(world, pos, state, player, hand, facing, hitX, hitY, hitZ);
}

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

@Nullable
@Override
public TileEntity createTileEntity(World world, IBlockState state) {
return new TileAspectHatch();
}


@Override
public PropertyEnum<IOHatchVariant> getVariant() {
return VARIANT;
}

}

This file was deleted.

Loading

0 comments on commit dba54ec

Please sign in to comment.