Skip to content

Commit

Permalink
重新分包
Browse files Browse the repository at this point in the history
将所有Renderer类改为仅客户端
  • Loading branch information
HeChuQIU committed Sep 15, 2023
1 parent e193cd7 commit 7f027f0
Show file tree
Hide file tree
Showing 40 changed files with 133 additions and 114 deletions.
16 changes: 8 additions & 8 deletions src/main/java/com/hechu/mindustry/Mindustry.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.hechu.mindustry;

import com.hechu.mindustry.block.BlockEntityRegister;
import com.hechu.mindustry.block.BlockRegister;
import com.hechu.mindustry.block.MechanicalDrillBlockEntityRenderer;
import com.hechu.mindustry.block.PneumaticDrillBlockEntityRenderer;
import com.hechu.mindustry.world.level.block.entity.BlockEntityRegister;
import com.hechu.mindustry.world.level.block.BlockRegister;
import com.hechu.mindustry.client.renderer.block.MechanicalDrillBlockEntityRenderer;
import com.hechu.mindustry.client.renderer.block.PneumaticDrillBlockEntityRenderer;
import com.hechu.mindustry.creative.CreativeModeTabRegister;
import com.hechu.mindustry.entity.EntityRegister;
import com.hechu.mindustry.entity.turrets.Duo;
import com.hechu.mindustry.entity.turrets.DuoRenderer;
import com.hechu.mindustry.item.ItemRegister;
import com.hechu.mindustry.world.entity.EntityRegister;
import com.hechu.mindustry.world.entity.turrets.Duo;
import com.hechu.mindustry.world.entity.turrets.DuoRenderer;
import com.hechu.mindustry.world.item.ItemRegister;
import com.mojang.logging.LogUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.world.item.CreativeModeTabs;
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
package com.hechu.mindustry.block;
package com.hechu.mindustry.client.renderer.block;

import com.hechu.mindustry.world.level.block.DrillBlock;
import com.hechu.mindustry.world.level.block.entity.DrillBlockEntity;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import org.jetbrains.annotations.NotNull;
import software.bernie.geckolib.core.animatable.GeoAnimatable;
import software.bernie.geckolib.model.GeoModel;
import software.bernie.geckolib.renderer.GeoBlockRenderer;

import static com.hechu.mindustry.block.DrillBlock.PART;
import static com.hechu.mindustry.world.level.block.DrillBlock.PART;

@OnlyIn(Dist.CLIENT)
public abstract class DrillBlockEntityRenderer<T extends DrillBlockEntity & GeoAnimatable> extends GeoBlockRenderer<T> {
public DrillBlockEntityRenderer(GeoModel<T> model) {
super(model);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.hechu.mindustry.client.renderer.block;

import com.hechu.mindustry.world.level.block.entity.MechanicalDrillBlockEntity;
import com.hechu.mindustry.world.level.block.model.MechanicalDrillModel;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

@OnlyIn(Dist.CLIENT)
public class MechanicalDrillBlockEntityRenderer extends DrillBlockEntityRenderer<MechanicalDrillBlockEntity> {

public MechanicalDrillBlockEntityRenderer() {
super(new MechanicalDrillModel());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.hechu.mindustry.client.renderer.block;

import com.hechu.mindustry.world.level.block.entity.PneumaticDrillBlockEntity;
import com.hechu.mindustry.world.level.block.model.PneumaticDrillModel;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

@OnlyIn(Dist.CLIENT)
public class PneumaticDrillBlockEntityRenderer extends DrillBlockEntityRenderer<PneumaticDrillBlockEntity>{
public PneumaticDrillBlockEntityRenderer() {
super(new PneumaticDrillModel());
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package com.hechu.mindustry.item;
package com.hechu.mindustry.client.renderer.item;

import net.minecraft.world.item.Item;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import software.bernie.geckolib.core.animatable.GeoAnimatable;
import software.bernie.geckolib.model.GeoModel;
import software.bernie.geckolib.renderer.GeoItemRenderer;

@OnlyIn(Dist.CLIENT)
public abstract class DrillRenderer<TItem extends Item & GeoAnimatable> extends GeoItemRenderer<TItem> {
public DrillRenderer(GeoModel model) {
super(model);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.hechu.mindustry.client.renderer.item;

import com.hechu.mindustry.world.item.PneumaticDrill;
import com.hechu.mindustry.world.item.model.MechanicalDrillModel;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

@OnlyIn(Dist.CLIENT)
public class MechanicalDrillRenderer extends DrillRenderer<PneumaticDrill> {
public MechanicalDrillRenderer() {
super(new MechanicalDrillModel());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.hechu.mindustry.client.renderer.item;

import com.hechu.mindustry.world.item.PneumaticDrill;
import com.hechu.mindustry.world.item.model.PneumaticDrillModel;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

@OnlyIn(Dist.CLIENT)
public class PneumaticDrillRenderer extends DrillRenderer<PneumaticDrill>{
public PneumaticDrillRenderer() {
super(new PneumaticDrillModel());
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.hechu.mindustry.creative;

import com.hechu.mindustry.Mindustry;
import com.hechu.mindustry.item.ItemRegister;
import com.hechu.mindustry.world.item.ItemRegister;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.CreativeModeTab;
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.hechu.mindustry.jade;

import com.hechu.mindustry.block.DrillBlockEntity;
import com.hechu.mindustry.block.HealthTestBlockEntity;
import com.hechu.mindustry.world.level.block.entity.DrillBlockEntity;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package com.hechu.mindustry.jade;

import com.hechu.mindustry.block.DrillBlockEntity;
import com.hechu.mindustry.block.HealthTestBlockEntity;
import com.hechu.mindustry.world.level.block.entity.HealthTestBlockEntity;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import snownee.jade.api.BlockAccessor;
import snownee.jade.api.IBlockComponentProvider;
import snownee.jade.api.IServerDataProvider;
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/hechu/mindustry/jade/MindustryPlugin.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.hechu.mindustry.jade;

import com.hechu.mindustry.Mindustry;
import com.hechu.mindustry.block.DrillBlock;
import com.hechu.mindustry.block.DrillBlockEntity;
import com.hechu.mindustry.block.HealthTestBlock;
import com.hechu.mindustry.block.HealthTestBlockEntity;
import com.hechu.mindustry.world.level.block.DrillBlock;
import com.hechu.mindustry.world.level.block.entity.DrillBlockEntity;
import com.hechu.mindustry.world.level.block.HealthTestBlock;
import com.hechu.mindustry.world.level.block.entity.HealthTestBlockEntity;
import net.minecraft.resources.ResourceLocation;
import snownee.jade.api.*;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.hechu.mindustry.entity;
package com.hechu.mindustry.world.entity;

import com.hechu.mindustry.Mindustry;
import com.hechu.mindustry.entity.turrets.Duo;
import com.hechu.mindustry.world.entity.turrets.Duo;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobCategory;
import net.minecraftforge.registries.DeferredRegister;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.hechu.mindustry.entity.turrets;
package com.hechu.mindustry.world.entity.turrets;

import com.hechu.mindustry.Mindustry;
import net.minecraft.sounds.SoundEvents;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package com.hechu.mindustry.entity.turrets;
package com.hechu.mindustry.world.entity.turrets;

import com.hechu.mindustry.entity.turrets.model.DuoModel;
import com.hechu.mindustry.world.entity.turrets.model.DuoModel;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import software.bernie.geckolib.model.GeoModel;
import software.bernie.geckolib.renderer.GeoEntityRenderer;

public class DuoRenderer extends GeoEntityRenderer<Duo> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.hechu.mindustry.entity.turrets.model;
package com.hechu.mindustry.world.entity.turrets.model;

import com.hechu.mindustry.Mindustry;
import com.hechu.mindustry.entity.turrets.Duo;
import com.hechu.mindustry.world.entity.turrets.Duo;
import net.minecraft.resources.ResourceLocation;
import software.bernie.geckolib.model.DefaultedEntityGeoModel;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.hechu.mindustry.item;
package com.hechu.mindustry.world.item;

import com.hechu.mindustry.block.DrillBlock;
import com.hechu.mindustry.world.level.block.DrillBlock;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Vec3i;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.hechu.mindustry.item;
package com.hechu.mindustry.world.item;

import net.minecraft.world.item.BlockItem;
import net.minecraft.world.level.block.Block;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.hechu.mindustry.item;
package com.hechu.mindustry.world.item;

import com.hechu.mindustry.Mindustry;
import com.hechu.mindustry.block.BlockRegister;
import com.hechu.mindustry.world.level.block.BlockRegister;
import net.minecraft.world.item.Item;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
Expand All @@ -10,10 +10,10 @@
public class ItemRegister {
// Create a Deferred Register to hold Items which will all be registered under the "mindustry" namespace
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, Mindustry.MODID);
public static final RegistryObject<Item> MECHANICAL_DRILL_ITEM = ITEMS.register(com.hechu.mindustry.item.MechanicalDrill.NAME,
public static final RegistryObject<Item> MECHANICAL_DRILL_ITEM = ITEMS.register(MechanicalDrill.NAME,
() -> new MechanicalDrill(BlockRegister.MECHANICAL_DRILL.get(), new Item.Properties()));
public static final RegistryObject<Item> PNEUMATIC_DRILL_ITEM = ITEMS.register(com.hechu.mindustry.item.PneumaticDrill.NAME,
public static final RegistryObject<Item> PNEUMATIC_DRILL_ITEM = ITEMS.register(PneumaticDrill.NAME,
() -> new PneumaticDrill(BlockRegister.PNEUMATIC_DRILL.get(), new Item.Properties()));
public static final RegistryObject<Item> HEALTH_TEST_ITEM = ITEMS.register(com.hechu.mindustry.item.HealthTest.NAME,
public static final RegistryObject<Item> HEALTH_TEST_ITEM = ITEMS.register(HealthTest.NAME,
() -> new HealthTest(BlockRegister.HEALTH_TEST.get(), new Item.Properties()));
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.hechu.mindustry.item;
package com.hechu.mindustry.world.item;

import com.hechu.mindustry.client.renderer.item.MechanicalDrillRenderer;
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
import net.minecraft.world.level.block.Block;
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.hechu.mindustry.item;
package com.hechu.mindustry.world.item;

import com.hechu.mindustry.client.renderer.item.PneumaticDrillRenderer;
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
Expand Down Expand Up @@ -27,12 +28,12 @@ public PneumaticDrill(@NotNull Block block, Item.Properties properties) {
@Override
public void initializeClient(Consumer<IClientItemExtensions> consumer) {
consumer.accept(new IClientItemExtensions() {
private PneumaticDrillRender renderer;
private PneumaticDrillRenderer renderer;

@Override
public BlockEntityWithoutLevelRenderer getCustomRenderer() {
if (this.renderer == null)
renderer = new PneumaticDrillRender();
renderer = new PneumaticDrillRenderer();
return this.renderer;
}
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.hechu.mindustry.item.model;
package com.hechu.mindustry.world.item.model;

import com.hechu.mindustry.Mindustry;
import com.hechu.mindustry.item.Drill;
import com.hechu.mindustry.world.item.Drill;
import net.minecraft.resources.ResourceLocation;
import software.bernie.geckolib.model.GeoModel;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.hechu.mindustry.item.model;
package com.hechu.mindustry.world.item.model;

import com.hechu.mindustry.item.MechanicalDrill;
import com.hechu.mindustry.world.item.MechanicalDrill;

public class MechanicalDrillModel extends DrillModel<MechanicalDrill> {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.hechu.mindustry.item.model;
package com.hechu.mindustry.world.item.model;

import com.hechu.mindustry.item.PneumaticDrill;
import com.hechu.mindustry.world.item.PneumaticDrill;

public class PneumaticDrillModel extends DrillModel<PneumaticDrill> {
@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.hechu.mindustry.block;
package com.hechu.mindustry.world.level.block;

import com.hechu.mindustry.Mindustry;
import net.minecraft.world.level.block.Block;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.hechu.mindustry.block;
package com.hechu.mindustry.world.level.block;

import com.hechu.mindustry.world.level.block.entity.DrillBlockEntity;
import com.mojang.logging.LogUtils;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
package com.hechu.mindustry.block;
package com.hechu.mindustry.world.level.block;

import com.hechu.mindustry.utils.capabilities.MindustryCapabilities;
import net.minecraft.advancements.CriteriaTriggers;
import com.hechu.mindustry.world.level.block.entity.HealthTestBlockEntity;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.stats.Stats;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.projectile.Projectile;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.BaseEntityBlock;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.RenderShape;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
Expand All @@ -29,7 +25,7 @@ public HealthTestBlock() {
public BlockEntity newBlockEntity(@NotNull BlockPos pPos, @NotNull BlockState pState) {
HealthTestBlockEntity healthTestBlockEntity = new HealthTestBlockEntity(pPos, pState);
healthTestBlockEntity.getCapability(MindustryCapabilities.HEALTH_HANDLER, null).ifPresent(healthHandler -> {
healthHandler.setHealth(500);
healthHandler.setHealth(100);
});
return healthTestBlockEntity;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.hechu.mindustry.block;
package com.hechu.mindustry.world.level.block;

import com.hechu.mindustry.world.level.block.entity.MechanicalDrillBlockEntity;
import net.minecraft.core.Vec3i;

public class MechanicalDrillBlock extends DrillBlock<MechanicalDrillBlockEntity> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.hechu.mindustry.block;
package com.hechu.mindustry.world.level.block;

import com.hechu.mindustry.world.level.block.entity.PneumaticDrillBlockEntity;
import net.minecraft.core.Vec3i;

public class PneumaticDrillBlock extends DrillBlock<PneumaticDrillBlockEntity> {
Expand Down
Loading

0 comments on commit 7f027f0

Please sign in to comment.