Fixed some errors and issues on dedicated servers

This commit is contained in:
malte0811 2018-06-13 19:09:35 +02:00
parent 63603d12f1
commit 7008f53faa
4 changed files with 40 additions and 20 deletions

View file

@ -24,7 +24,6 @@ import malte0811.industrialWires.containers.ContainerPanelCreator;
import malte0811.industrialWires.containers.ContainerRSPanelConn;
import malte0811.industrialWires.containers.ContainerRenameKey;
import malte0811.industrialWires.converter.MechEnergy;
import net.minecraft.client.audio.ISound;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
@ -37,7 +36,7 @@ import net.minecraftforge.fml.common.network.IGuiHandler;
import java.util.Set;
public abstract class CommonProxy implements IGuiHandler {
public class CommonProxy implements IGuiHandler {
public void preInit() {
}
@ -86,5 +85,5 @@ public abstract class CommonProxy implements IGuiHandler {
public void updateMechMBTurningSound(TileEntityMechMB te, MechEnergy energy) {}
public void stopAllSoundsExcept(BlockPos pos, Set<ISound> excluded) {}
public void stopAllSoundsExcept(BlockPos pos, Set<?> excluded) {}
}

View file

@ -47,7 +47,10 @@ package malte0811.industrialWires;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.network.datasync.DataSerializers;
import net.minecraft.network.datasync.EntityDataManager;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvent;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.Mod;
@ -63,6 +66,7 @@ package malte0811.industrialWires;
import net.minecraftforge.fml.common.registry.EntityRegistry;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.registries.IForgeRegistry;
import org.apache.logging.log4j.Logger;
import java.util.ArrayList;
@ -70,6 +74,8 @@ package malte0811.industrialWires;
import static malte0811.industrialWires.blocks.wire.BlockTypes_IC2_Connector.*;
import static malte0811.industrialWires.converter.MechMBPart.EXAMPLE_MECHMB_LOC;
import static malte0811.industrialWires.entities.EntityBrokenPart.MARKER_TEXTURE;
import static malte0811.industrialWires.entities.EntityBrokenPart.RES_LOC_SERIALIZER;
import static malte0811.industrialWires.wires.IC2Wiretype.*;
@Mod(modid = IndustrialWires.MODID, version = IndustrialWires.VERSION, dependencies = "required-after:immersiveengineering@[0.12-77,);after:ic2",
@ -79,6 +85,14 @@ public class IndustrialWires {
public static final String MODID = "industrialwires";
public static final String VERSION = "${version}";
public static final String MODNAME = "Industrial Wires";
public static final ResourceLocation TINNITUS_LOC = new ResourceLocation(IndustrialWires.MODID, "tinnitus");
public static final ResourceLocation LADDER_START = new ResourceLocation(IndustrialWires.MODID, "jacobs_ladder_start");//~470 ms ~=9 ticks
public static final ResourceLocation LADDER_MIDDLE = new ResourceLocation(IndustrialWires.MODID, "jacobs_ladder_middle");
public static final ResourceLocation LADDER_END = new ResourceLocation(IndustrialWires.MODID, "jacobs_ladder_end");//~210 ms ~= 4 ticks
public static final ResourceLocation MARX_BANG = new ResourceLocation(IndustrialWires.MODID, "marx_bang");
public static final ResourceLocation MARX_POP = new ResourceLocation(IndustrialWires.MODID, "marx_pop");
public static final ResourceLocation TURN_FAST = new ResourceLocation(IndustrialWires.MODID, "mech_mb_fast");
public static final ResourceLocation TURN_SLOW = new ResourceLocation(IndustrialWires.MODID, "mech_mb_slow");
public static final List<BlockIWBase> blocks = new ArrayList<>();
public static final List<Item> items = new ArrayList<>();
@ -176,6 +190,9 @@ public class IndustrialWires {
GameRegistry.registerTileEntity(TileEntityUnfinishedPanel.class, MODID + ":unfinished_panel");
GameRegistry.registerTileEntity(TileEntityComponentPanel.class, MODID + ":single_component_panel");
GameRegistry.registerTileEntity(TileEntityDischargeMeter.class, MODID + ":discharge_meter");
DataSerializers.registerSerializer(RES_LOC_SERIALIZER);
MARKER_TEXTURE = EntityDataManager.createKey(EntityBrokenPart.class, RES_LOC_SERIALIZER);
EntityRegistry.registerModEntity(new ResourceLocation(MODID, "broken_part"), EntityBrokenPart.class,
"broken_part", 0, this, 64, 5, true);
@ -214,6 +231,22 @@ public class IndustrialWires {
event.getRegistry().register(new ItemKey());
}
@SubscribeEvent
public static void registerSounds(RegistryEvent.Register<SoundEvent> event) {
registerSound(event.getRegistry(), TINNITUS_LOC);
registerSound(event.getRegistry(), LADDER_START);
registerSound(event.getRegistry(), LADDER_MIDDLE);
registerSound(event.getRegistry(), LADDER_END);
registerSound(event.getRegistry(), MARX_BANG);
registerSound(event.getRegistry(), MARX_POP);
registerSound(event.getRegistry(), TURN_FAST);
registerSound(event.getRegistry(), TURN_SLOW);
}
private static void registerSound(IForgeRegistry<SoundEvent> reg, ResourceLocation loc) {
reg.register(new SoundEvent(loc).setRegistryName(loc));
}
@SubscribeEvent
public static void registerRecipes(RegistryEvent.Register<IRecipe> event) {
Recipes.addRecipes(event.getRegistry());

View file

@ -84,6 +84,8 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.*;
import static malte0811.industrialWires.IndustrialWires.*;
@SideOnly(Side.CLIENT)
public class ClientProxy extends CommonProxy {
@Override
@ -381,14 +383,6 @@ public class ClientProxy extends CommonProxy {
}
private Map<BlockPos, List<ISound>> playingSounds = new HashMap<>();
private static final ResourceLocation TINNITUS_LOC = new ResourceLocation(IndustrialWires.MODID, "tinnitus");
private static final ResourceLocation LADDER_START = new ResourceLocation(IndustrialWires.MODID, "jacobs_ladder_start");//~470 ms ~=9 ticks
private static final ResourceLocation LADDER_MIDDLE = new ResourceLocation(IndustrialWires.MODID, "jacobs_ladder_middle");
private static final ResourceLocation LADDER_END = new ResourceLocation(IndustrialWires.MODID, "jacobs_ladder_end");//~210 ms ~= 4 ticks
private static final ResourceLocation MARX_BANG = new ResourceLocation(IndustrialWires.MODID, "marx_bang");
private static final ResourceLocation MARX_POP = new ResourceLocation(IndustrialWires.MODID, "marx_pop");
private static final ResourceLocation TURN_FAST = new ResourceLocation(IndustrialWires.MODID, "mech_mb_fast");
private static final ResourceLocation TURN_SLOW = new ResourceLocation(IndustrialWires.MODID, "mech_mb_slow");
@Override
public void playJacobsLadderSound(TileEntityJacobsLadder te, int phase, Vec3d soundPos) {
@ -473,7 +467,7 @@ public class ClientProxy extends CommonProxy {
}
@Override
public void stopAllSoundsExcept(BlockPos pos, Set<ISound> excluded) {
public void stopAllSoundsExcept(BlockPos pos, Set<?> excluded) {
if (playingSounds.containsKey(pos)) {
SoundHandler manager = Minecraft.getMinecraft().getSoundHandler();
List<ISound> sounds = playingSounds.get(pos);

View file

@ -22,8 +22,6 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.datasync.DataParameter;
import net.minecraft.network.datasync.DataSerializer;
import net.minecraft.network.datasync.DataSerializers;
import net.minecraft.network.datasync.EntityDataManager;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.ResourceLocation;
@ -37,7 +35,7 @@ import java.util.List;
import static malte0811.industrialWires.util.NBTKeys.TEXTURE;
public class EntityBrokenPart extends /*EntityArrow*/ Entity {
public class EntityBrokenPart extends Entity {
public static final DataSerializer<ResourceLocation> RES_LOC_SERIALIZER = new DataSerializer<ResourceLocation>() {
@Override
public void write(@Nonnull PacketBuffer buf, @Nonnull ResourceLocation value) {
@ -64,12 +62,8 @@ public class EntityBrokenPart extends /*EntityArrow*/ Entity {
return new ResourceLocation(value.getResourceDomain(), value.getResourcePath());
}
};
private static DataParameter<ResourceLocation> MARKER_TEXTURE;
public static DataParameter<ResourceLocation> MARKER_TEXTURE;
static {
DataSerializers.registerSerializer(RES_LOC_SERIALIZER);
MARKER_TEXTURE = EntityDataManager.createKey(EntityBrokenPart.class, RES_LOC_SERIALIZER);
}
private static final double HARDNESS_MAX = 15;
private static final double DESPAWN_DELAY_GROUND = 400;